mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-10 01:33:51 +01:00
COGLES2Driver: fix swapped color screenshots
This commit is contained in:
parent
08057945f6
commit
05c109a1d5
@ -2591,6 +2591,22 @@ COGLES2Driver::~COGLES2Driver()
|
|||||||
}
|
}
|
||||||
delete [] tmpBuffer;
|
delete [] tmpBuffer;
|
||||||
|
|
||||||
|
// also GL_RGBA doesn't match the internal encoding of the image (which is BGRA)
|
||||||
|
if (GL_RGBA == internalformat && GL_UNSIGNED_BYTE == type)
|
||||||
|
{
|
||||||
|
pixels = static_cast<u8*>(newImage->getData());
|
||||||
|
for (u32 i = 0; i < ScreenSize.Height; i++)
|
||||||
|
{
|
||||||
|
for (u32 j = 0; j < ScreenSize.Width; j++)
|
||||||
|
{
|
||||||
|
u32 c = *(u32*) (pixels + 4 * j);
|
||||||
|
*(u32*) (pixels + 4 * j) = (c & 0xFF00FF00) |
|
||||||
|
((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
|
||||||
|
}
|
||||||
|
pixels += pitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (testGLError(__LINE__))
|
if (testGLError(__LINE__))
|
||||||
{
|
{
|
||||||
newImage->drop();
|
newImage->drop();
|
||||||
|
Loading…
Reference in New Issue
Block a user