Hello.
I am trying to read the contents of a texture. It works but not quite as I expected.
My code looks somewhat like this:
byte[] pixels = new byte[width * height * 4];
ByteBuffer buffer = ByteBuffer.allocateDirect(pixels.length).order(ByteOrder.nativeOrder());
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture_id);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer);
buffer.get(pixels);
System.out.println(Arrays.toString(pixels));
However, the array pixels is filled only with the values 0 and -1.
The texture is an image with only white and transparent pixels.
What am I doing wrong?
Thanks in advance.