Hi
I couldn't really solve the problem with the JOGL demo code, because I'm still getting a GL_INVALID_ENUM exception.
File pathes to texture files are correct. The texture data must have been created properly, because I can query the height and width from the TextureData objects (or can I get them even if the texture data object isn' t set up correctly?).
I don't know why, but the GL_INVALID_ENUM occurs right at the first updateImage() method
1
| this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.posX), true, null), GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X); |
This is how I initialize the cube map texture and I can't find any significant deviations from the JOGL demos Cubemap.class code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| private void init(GL gl) { this.cubeMapTex = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP);
try { this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.posX), true, null), GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X); this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.negX), true, null), GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X); this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.posY), true, null), GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y); this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.negY), true, null), GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y); this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.posZ), true, null), GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z); this.cubeMapTex.updateImage(TextureIO.newTextureData(new File(this.negZ), true, null), GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z); } catch (GLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
|
Here is the compiler's error report:
GL vendor: ATI Technologies Inc.
GL version: 2.0.5885 WinXP Release
GL renderer: 128MB ATI Radeon X1300 x86/SSE2
javax.media.opengl.GLException: glGetError() returned the following error codes after a call to glTexParameteri(): GL_INVALID_ENUM
at javax.media.opengl.DebugGL.checkGLGetError(DebugGL.java:12715)
at javax.media.opengl.DebugGL.glTexParameteri(DebugGL.java:9113)
at com.sun.opengl.util.texture.Texture.updateImage(Texture.java:433)
at de.adventure.engine.effect.environmentmapping.CubeMap.init(CubeMap.java:82)
at de.adventure.engine.effect.environmentmapping.CubeMap.<init>(CubeMap.java:67)
at Renderer.init(Renderer.java:283)
at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)
at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:271)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)
at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:305)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
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)