Re: Issue: java.lang.IndexOutOfBoundsException (Textures)
Posted by
Haroogan on
Oct 11, 2010; 5:57pm
URL: https://forum.jogamp.org/Issue-java-lang-IndexOutOfBoundsException-Textures-tp1682049p1682286.html
The first two references are to guys who didnt rewind their ByteBuffers... My ByteBuffer is rewinded. My problem is that I am doing everything right, but somehow JOGL wants more bytes from me on irregular size images. Also I have noticed that when I was creating ByteBuffer with alpha channel and specifing GL_RGBA in glTexImage2D like that, the problem was gone:
gl.glTexImage2D(GL.GL_TEXTURE_2D,
0,
GL.GL_RGB,
texture.getWidth(),
texture.getHeight(),
0,
GL.GL_RGBA,
GL.GL_UNSIGNED_BYTE,
texture.getPixelsAsByteBuffer());
But why would I do that? What if I want to keep my ByteBuffer without alpha channel component..?