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:
- creating a new IntBuffer and copying the contents
- just using byte buffers
- using a direct buffer
Thanks