I'm trying to read the pixeldata from multiple predefined squares on the screen. However for some reason the bytebuffer that gets returned is the same for whichever square I choose.
This is the function I'm using:
private void loadByteBuffer()
{
int width = (bounds[2] - bounds[0]);
int height = (bounds[3] - bounds[1]);
GLReadBufferUtil util = new GLReadBufferUtil(false, true);
util.readPixels(gl, bounds[0], bounds[1], width, height, false);
TextureData texData = util.getTextureData();
byteBuffer = (ByteBuffer) texData.getBuffer();
util.dispose(gl);
texData.destroy();
}
is there something I'm doing wrong?