Hi,
I am using the following code to retrieve pixels from a ccsprite
texture~~>beginWithClear; // pink background
this~~>visit();
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, renderTextureWidth, renderTextureHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
texture~~>end;
texture~~>release();
+this->getTexture()->initWithData(buffer,kCCTexture2DPixelFormat_RGBA8888,this->getTexture()>getPixelsWide,this>getTexture()>getPixelsHigh,CCSizeMake);+ it is there for testing purposes to check whether the bytes were successfully read.
Notice the underlined line
This works fine when I test it on the windows (vs2010) but when I compile it with cygwin and run it on android the image is distorted completely as if glReadPixels did not work properly. Please see screenshots below:
Windows (works):
The screenshot below was taken from android (I took a photo with another phone - please pardon the quality):
win.png (27.7 KB)