Bug in gluegen?

I received this exception stack trace:

Caused by: java.lang.UnsupportedOperationException
	at java.nio.IntBuffer.array(IntBuffer.java:939)
	at com.sun.gluegen.runtime.BufferFactory.getArray(BufferFactory.java:126)
	at com.sun.opengl.impl.GLImpl.glTexSubImage2D(GLImpl.java:21393)
	at javax.media.opengl.DebugGL.glTexSubImage2D(DebugGL.java:9135)

when I was creating a texture. It seems to be caused when you allocate a normal ByteBuffer, and then call asIntBuffer() on that buffer. I then used that IntBuffer to pass to openGL, but the IntBuffer’s hasArray() method returns false (probably because the backing array is byte[] instead of int[]).

Is there any workaround for this besides:

  1. creating a new IntBuffer and copying the contents
  2. just using byte buffers
  3. using a direct buffer

Thanks

I don’t know for sure, but I was under the impression, that when you use Buffers with JOGL, they always have to be direct!?

It turns out that this only has to be true for gl functions that access the buffer data at some later point. For textures, it transfers the data immediately, so it doesn’t care if buffers are direct or indirect. I’m interested in keeping my textures indirect to free up direct memory for my geometry.