Im trying to convert the code from SpaceInvaders103 tutorial to JSR213 and the only problem i have is with TextureLoader.java and Texture.java
I get this exceptions when i try to run spaceinvaders and honestly the error messages in jogl could be a bit more friendly. Any clue what this means:
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Required 131072 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:19579)
at org.newdawn.spaceinvaders.jogl.TextureLoader.getTexture(TextureLoader.java:155)
at org.newdawn.spaceinvaders.jogl.TextureLoader.getTexture(TextureLoader.java:97)
at org.newdawn.spaceinvaders.jogl.JoglSprite.<init>(JoglSprite.java:35)
at org.newdawn.spaceinvaders.ResourceFactory.getSprite(ResourceFactory.java:116)
at org.newdawn.spaceinvaders.Game.initialise(Game.java:89)
at org.newdawn.spaceinvaders.jogl.JoglGameWindow.init(JoglGameWindow.java:175)
at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:71)
at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:245)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:123)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:239)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "Thread-2" javax.media.opengl.GLException: java.lang.NullPointerException
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:205)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:237)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
at com.sun.opengl.util.Animator.display(Animator.java:144)
at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.newdawn.spaceinvaders.Game.frameRendering(Game.java:277)
at org.newdawn.spaceinvaders.jogl.JoglGameWindow.display(JoglGameWindow.java:198)
at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:77)
at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:262)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:128)
at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:279)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)