I’m having a problem building a 2D mipmap on JOGL 1.1b10 on OSX 10.3.9 (Powerbook G4 ATI Radeon 9700 card). No matter what image I send to the function, it keeps giving me a GL_INVALID_VALUE exception inside of an internal call to glTexImage2D. Here’s the code:
glu.gluBuild2DMipmaps( texture.target,
texture.dstPixelFormat,
texture.width,
texture.height,
texture.srcPixelFormat,
GL.GL_UNSIGNED_BYTE,
texture.byteBuffer );
where, texture.target is GL_TEXTURE_2D, dstPixelFormat is GL_RGBA, srcPixelFormat is GL_RGBA, width and height are 256 and byteBuffer points to image data loaded from a PNG file (which looks ok with Preview).
The error I get is this:
Initializing new texture 22 - /Users/abegel/Developer/eandl/starlogo-tng/build/models/hulk/blue.png
building mipmap for image width: 256 height: 256
net.java.games.jogl.GLException: glGetError() returned the following error codes after a call to glTexImage2D(): GL_INVALID_VALUE
at net.java.games.jogl.DebugGL.checkGLGetError(DebugGL.java:13901)
at net.java.games.jogl.DebugGL.glTexImage2D(DebugGL.java:10554)
at net.java.games.jogl.impl.mipmap.Mipmap.closestFit(Mipmap.java:259)
at net.java.games.jogl.impl.mipmap.Mipmap.gluBuild2DMipmaps(Mipmap.java:676)
at net.java.games.jogl.impl.GLUImpl.gluBuild2DMipmapsJava(GLUImpl.java:587)
at net.java.games.jogl.impl.GLUImpl.gluBuild2DMipmaps(GLUImpl.java:823)
at torusworld.TextureManager.initTexture(TextureManager.java:186)
at torusworld.TextureManager.initNewTextures(TextureManager.java:137)
at torusworld.TorusWorld.drawTurtle(TorusWorld.java:2076)
at torusworld.TorusWorld.renderMobileObject(TorusWorld.java:2024)
at torusworld.TorusWorld.renderMobileObjects(TorusWorld.java:1957)
at torusworld.TorusWorld.drawIt(TorusWorld.java:1874)
at torusworld.TorusWorld.display(TorusWorld.java:1249)
at net.java.games.jogl.impl.GLDrawableHelper.display(GLDrawableHelper.java:74)
at net.java.games.jogl.GLCanvas$DisplayAction.run(GLCanvas.java:241)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:292)
at net.java.games.jogl.impl.macosx.MacOSXOnscreenGLContext.invokeGL(MacOSXOnscreenGLContext.java:84)
Using Apple’s OpenGL Profiler, I found the arguments for the offending glTexImage2D() call at the end of this sequence (the calls above it are definitely my own that happen before the gluBuild2DMipmap code):
/* context 0x023a9800 / glGenTextures(14, 0x49ff88ec);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glBindTexture(GL_TEXTURE_2D, 18);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glGetString(GL_VERSION);
/ context 0x023a9800 / glGetError(); / returns: GL_ZERO /
/ context 0x023a9800 / glTexImage2D(GL_PROXY_TEXTURE_2D, 1, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0x00000000);
/ context 0x023a9800 / glGetError(); / returns: GL_INVALID_VALUE */
Any idea what I can do to debug this further? This works perfectly with the same JOGL on a PC running WinXP with an NVidia card.
Thanks,
Andrew