Results 1 to 2 of 2

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

  1. #1
    Newbie
    Join Date
    Apr 2017
    Posts
    1

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

    Hello,

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

    The process is the same,
    1. glBindTexture
    2. glReadPixels


    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

    Code :
    renderCamera.targetTexture.GetNativeTexturePtr();

    Bind the texture by
    Code :
    glBindTexture(GL_TEXTURE_2D, (GLuint) textureId);
    checkGLError("glBindTexture");

    Get the pixels data by
    Code :
    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~~~

    Anyone can help me?

  2. #2
    Same issue here, can somebody help us?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean