Login  Register

Loading texture error

Posted by GuilhermeAmorim on Jul 04, 2010; 1:55pm
URL: https://forum.jogamp.org/Loading-texture-error-tp942252.html

I need some help here
I trying to load a texture to draw in the screen but I can only get a exception:

java.lang.IndexOutOfBoundsException: Required 196608 remaining bytes in buffer, only had 0
        at com.sun.gluegen.runtime.BufferFactory.rangeCheckBytes(BufferFactory.java:274)
        at com.sun.opengl.impl.GLImpl.glTexImage2D(GLImpl.java:21146)

in this line:

gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGB, textureImage.getWidth(), textureImage.getHeight(), 0, gl.GL_RGB, gl.GL_UNSIGNED_BYTE, buffer);


I tried to make the buffer have twice the size and the exception is gone, but the texture too, remais only the cube in black.

This is the 1.1.1a version

Thanks for reading