Code: Select all
When I call this in Android, this gives me back a PixelBox full of 0s ... all black. I think it's because in EGLWindow::copyContentsToMemory we are calling glReadPixels with format GL_RGB. With any format other than GL_RGBA it results in GL_INVALID_OPERATION and so it never touched the PixelBox's data. Forcing the format to GL_RGBA does fix the issue, but methods like RenderTarget::writeContentsToFile are always going to pass down a PixelBox with PixelFormat PF_BYTE_RGB when called from a RenderWindow because of suggestPixelFormat being overridden.
I just hacked my version so it works, but I'm a bit lost on how this could be patched properly. Maybe it's as simple as overriding suggestPixelFormat from EGLWindow, assuming this issue affects all GLES2 devices, or AndroidEGLWindow if it's Android specific? ... I'll do some more testing