Estoy tomando una captura de pantalla con glReadPixels para realizar un efecto "cruzado" entre dos imágenes.OpenGL ES - glReadPixels
En el simulador Mermelada SDK, la pantalla se toma muy bien y el efecto "cross-over" funciona un convite:
Sin embargo, esto es lo que parece en dispositivos iOS y Android - corrompido: http://www.eikona.info/images/81269689420703803966.png
Siempre leo la pantalla como RGBA 1 byte/canal, como documentation says SIEMPRE se acepta.
Aquí es el código utilizado para tomar la captura de pantalla:
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);
}
Si elimina su bloque 'de arriba hacia abajo', ¿la corrupción desaparece? ¿Solo al revés? ¿O está dañado _y_ al revés? – sarnold
La cosa es que no tengo un dispositivo, así que tengo que enviarlo a mi cliente, luego esperar a que lo instale y pruebe ... todo esto puede demorar hasta un par de días :-( –
Los comentarios anteriores son ahora irrelevante después de volver a editar mi mensaje para reflejar mis nuevos hallazgos. –