0

I have a problem about Android get color data from textureID

I hope use openGLES to got real pixels data and modify it

This is my code and in the Gallerydata. All of bytes are zero, but glgetError is 0.

I don't know why. Is Any genius man can help me?

byte[] Galleydata = new byte[GalleyWidth*GalleyHeight*4];
ByteBuffer buffer = ByteBuffer.wrap(Galleydata);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texturePtr);
GLES20.glReadPixels(0,0,GalleyWidth,GalleyHeight,GLES20.GL_RGBA,GLES20.GL_UNSIGNED_BYTE,buffer);
buffer.get(Galleydata);
J.S Lee
  • 29
  • 2
  • 9

1 Answers1

0

glReadPixels returns pixels from a framebuffer. So you need to render your texture first using one of the glDraw* functions. Generally you need to render two triangles (since quads are mostly not supported, and could be supported only through extensions).

Reaper
  • 747
  • 1
  • 5
  • 15