As one of my first experiments with jogl, I decided to port a md2 loader from one of the c++ tutorials I had read. Everything works fine except for one part where gluScaleImage is used to scale non-standard texture sizes to a power of two. Whenever my program gets to that statement, I get the error:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: [F
at net.java.games.jogl.impl.GLUImpl.gluScaleImageJava(GLUImpl.java:494)
at net.java.games.jogl.impl.GLUImpl.gluScaleImage(GLUImpl.java:959)
at MD2Model.LoadPCXTexture(MD2Model.java:737)
at MD2Model.LoadTexture(MD2Model.java:486)
at MD2Model.load(MD2Model.java:166)
at GLPanel1.init(GLPanel1.java:53)
at net.java.games.jogl.impl.GLDrawableHelper.init(GLDrawableHelper.java:68)
at net.java.games.jogl.GLCanvas$InitAction.run(GLCanvas.java:234)
at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:168)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:129)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:246)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:76)
at net.java.games.jogl.GLCanvas$2.run(GLCanvas.java:122)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
at this line:
myGLU.gluScaleImage (GL.GL_RGBA, thisTexture.width, thisTexture.height, GL.GL_UNSIGNED_BYTE, unscaledData, thisTexture.scaledWidth, thisTexture.scaledHeight, GL.GL_UNSIGNED_BYTE, thisTexture.data);
With textures that don’t need resizing, the rest of the code works fine by just copying unscaledData onto thisTexture.data. (both are arrays of floats to hold the texture data) Any input would be greatly appreciated
-Ben