我正在使用glReadPixels进行截图,以在两个图像之间执行“跨越”效果.
在Marmalade SDK模拟器上,截图被拍摄得很好,“交叉”效果起到了作用:
但是,这是iOS和Android设备的外观 – 损坏:
http://www.eikona.info/images/81269689420703803966.png
我总是将屏幕看作RGBA 1字节/通道,因为documentation says总是被接受.
uint8* Gfx::ScreenshotBuffer(int& deviceWidth,int& deviceHeight,int& dataLength) { /// width/height deviceWidth = IwGxGetDeviceWidth(); deviceHeight = IwGxGetDeviceHeight(); int rowLength = deviceWidth * 4; /// data always returned by GL as RGBA,1 byte/each dataLength = rowLength * deviceHeight; // set the target framebuffer to read glPixelStorei(GL_UNPACK_ALIGNMENT,1); glPixelStorei(GL_PACK_ALIGNMENT,1); uint8* buffer = new uint8[dataLength]; glReadPixels(0,deviceWidth,deviceHeight,GL_RGBA,GL_UNSIGNED_BYTE,buffer); return buffer; } void Gfx::ScreenshotImage(CIwImage* img,uint8*& pbuffer) { int deviceWidth,dataLength; pbuffer = ScreenshotBuffer(deviceWidth,dataLength); img->SetFormat(CIwImage::ABGR_8888); img->SetWidth(deviceWidth); img->SetHeight(deviceHeight); img->SetBuffers(pbuffer,dataLength,0); }