0

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?

user1870238
  • 447
  • 7
  • 20
  • Not surprising... given the code you have shown, one can assume that `bounds` is constant. It should probably be a parameter in the function. – Andon M. Coleman May 22 '14 at 17:01
  • My bad, I should have elaborated a bit more. this method is part of a class of which multiple instances exist. Each instance has it's own values for bounds. – user1870238 May 22 '14 at 17:11

0 Answers0