Problems getting JOGL to run

Hi,

I’m pointing a GL4Java app to JOGL. The GL4Java version runs great on my machine (a ThinkPad T40p). But I can’t get the code modified for JOGL to run.

When I use the September 2003 builds and DebugGL, I get a GL_INVALID_ARGUMENT exception after calling:


    gl.glMatrixMode(GL.GL_MODELVIEW);

which seems surprising since that’s not even listed as an error code for that function. I’ve run a TraceGL and nothing to unusual is going on.

So then I commented out the line and ran again. Now I get:


glBindTexture(3553,1)
java.lang.NullPointerException
        at java.lang.reflect.Array.getLength(Native Method)
        at net.java.games.jogl.TraceGL.dumpArray(TraceGL.java:13672)
        at net.java.games.jogl.TraceGL.glTexImage2D(TraceGL.java:10556)
        at agile2d.opengl.Texture.create(Texture.java:281)
        at agile2d.opengl.Texture.loadPixels(Texture.java:164)

OK. So clearly TraceGL has some issues in the Sept builds. I decided to switch to the nightly builds.

Using yesterday’s build, now I get:


net.java.games.jogl.GLException: Method "wglGetExtensionsStringARB" not availabl
e at net.java.games.jogl.impl.windows.WindowsGLImpl.wglGetExtensionsString
ARB(WindowsGLImpl.java:30520)        at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:273)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:204)
        at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:133)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent
(WindowsOnscreenGLContext.java:110)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)

Which is confusing. If GL4Java can run this code ok on my machine, JOGL should handle it too. I’m on Windows XP with Service Pack 2, Java 1.4.2.

Any comments/suggestions really welcome.

The code I’m porting is Agile2D, an implementation of Graphics2D that runs on OpenGL. It would be cool to have it running via JOGL.

Cheers

Jon

I don’t know what’s happening with the DebugGL’s treatment of the glMatrixMode call. If you could boil it down into a test case that would be good, or if you could just file an issue on the JOGL web page and post a pointer to your current Agile2D that would help also. There is probably still something wrong with the DebugGL’s calling of glGetError().

Here’s a patch for the exception being thrown from the nightly build. This will be fixed in tonight’s or tomorrow night’s build.


*** WindowsGLContext.java.~1.10.~ Tue Apr 13 17:06:46 2004
--- WindowsGLContext.java Wed Apr 21 18:32:36 2004
***************
*** 270,276 ****
          // It seems that at this point in initialization,
          // glGetString(GL.GL_EXTENSIONS) is returning null, so we
          // need to use wglGetExtensionsStringARB
!         String availableWGLExtensions = dummyGL.wglGetExtensionsStringARB(hdc);
          if (availableWGLExtensions.indexOf("WGL_ARB_pixel_format") >= 0) {
            haveWGLChoosePixelFormatARB = true;
            if (availableWGLExtensions.indexOf("WGL_ARB_multisample") >= 0) {
--- 270,283 ----
          // It seems that at this point in initialization,
          // glGetString(GL.GL_EXTENSIONS) is returning null, so we
          // need to use wglGetExtensionsStringARB
!         String availableWGLExtensions = "";
!         // FIXME: would like to do this operation without throwing an
!         // exception if wglGetExtensionsStringARB isn't available
!         try {
!           availableWGLExtensions = dummyGL.wglGetExtensionsStringARB(hdc);
!         } catch (GLException e) {
!           // Apparently wglGetExtensionsStringARB wasn't available; ignore
!         }
          if (availableWGLExtensions.indexOf("WGL_ARB_pixel_format") >= 0) {
            haveWGLChoosePixelFormatARB = true;
            if (availableWGLExtensions.indexOf("WGL_ARB_multisample") >= 0) {

BTW, the TraceGL exception is occurring because null is being passed down for the 2D texture’s data. I don’t know whether that’s valid, but here’s a patch for that exception (also will be checked in).


*** BuildComposablePipeline.java.~1.4.~ Mon Jul 14 23:10:14 2003
--- BuildComposablePipeline.java Wed Apr 21 18:41:14 2004
***************
*** 473,478 ****
--- 473,479 ----
        output.println("private int indent = 0;"); 
        output.println("protected String dumpArray(Object obj)");
        output.println("{");
+       output.println("  if (obj == null) return \"[null]\";");
        output.println("  StringBuffer sb = new StringBuffer(\"[\");");
        output.println("  int len  = java.lang.reflect.Array.getLength(obj);");
        output.println("  int count = Math.min(len,16);");