2つの画像間で「クロスオーバー」効果を実行するためにglReadPixelsでスクリーンショットを撮っています。
Marmalade SDKシミュレーターでは、スクリーンショットは問題なく撮影され、「クロスオーバー」効果はうまく機能します。
ただし、これはiOSおよびAndroidデバイスでの外観です-破損しています:(
ソース:eikona.info)
ドキュメントには常に受け入れられると書かれているので、私は常に画面をRGBA1バイト/チャネルとして読み取ります。
スクリーンショットを撮るために使用されるコードは次のとおりです。
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, 0, deviceWidth, deviceHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
return buffer;
}
void Gfx::ScreenshotImage(CIwImage* img, uint8*& pbuffer) {
int deviceWidth, deviceHeight, dataLength;
pbuffer = ScreenshotBuffer(deviceWidth, deviceHeight, dataLength);
img->SetFormat(CIwImage::ABGR_8888);
img->SetWidth(deviceWidth);
img->SetHeight(deviceHeight);
img->SetBuffers(pbuffer, dataLength, 0, 0);
}