Hey guys, I’ve been using the grabScreen functions to save alpha PNG screenshots on my Mac. I think in your switch statement to determine channel order, you left out an if/else to determine endianess… right now it looks like this:
case 32:
glReadPixels(_x, _y, _w, _h, GL_RGBA,GL_UNSIGNED_BYTE, pixels);
break;
I think it should be like this:
case 32:
#ifdef TARGET_LITTLE_ENDIAN
glReadPixels(_x, _y, _w, _h, GL_BGRA,GL_UNSIGNED_BYTE, pixels);
#else
glReadPixels(_x, _y, _w, _h, GL_RGBA,GL_UNSIGNED_BYTE, pixels);
#endif
break;
Without the if/else my PNGs all have the red and blue channels swapped, but this change solves the problem!