glReadPixels in OpenGL ES 2.0 and 3.0 has different data! Anyone can help me?


I’m developing Unity3D plugin for Android. Currently I encounter the strange problem just like title.

The process is the same,

I have two cameras in Unity3D scene, which one is main camera and the other is render camera.

I pass the render camera texture ID to OpenGL ES


Bind the texture by

glBindTexture(GL_TEXTURE_2D, (GLuint) textureId);

Get the pixels data by

pixels = (GLubyte *) malloc(4 * width * height);
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

However, the pixel data by using OpenGL ES 2.0 is correct which comes from the render camera, by using OpenGL ES 3.0 is wrong which comes from the main camera and only one-fourth region of the render texture!

I’m stuck here~~~ :frowning:

Anyone can help me?

Same issue here, can somebody help us?

Look at :
Android glReadPixels performance issues