Suddenly none of my jogl apps will run!

A week or so, all my jogl apps were working just fine. Today however, all my apps give me this nice little message at startup:


java.lang.NullPointerException
at net.java.games.jogl.impl.windows.WindowsGLContextFactory.getDummyGL(WindowsGLContextFactory.java:117)
at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAn
dCreateContext(WindowsGLContext.java:279)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(Wind
owsOnscreenGLContext.java:211)
at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(Windows
GLContext.java:135)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent
(WindowsOnscreenGLContext.java:110)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:250)
at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:208)
at net.java.games.jogl.GLCanvas.display(GLCanvas.java:75)
at net.java.games.jogl.Animator$1.run(Animator.java:107)
at java.lang.Thread.run(Thread.java:534)


I can’t recall having made any significant changes since then, but it’s possible that the jre has automatically updated to v. 1.5.something. However, uninstalling and going back to v. 1.4.2_03 did not help the situation. I’ve also tried earlier builds of the jogl binaries and jogl.jar without success. Installing Matlab v7 may also have made som changes to the jre, but I can’t see how that should affect jogl. The code that’s common to all my jogl apps is:


   public static void main(String[] args)
   {
          GLCanvas drawable = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
          drawable.addGLEventListener(new MyClass());
          JFrame frame = new JFrame("Headline");
          frame.getContentPane().add(drawable);
          frame.setSize(640, 480);
          frame.setLocationRelativeTo(null);
          final Animator animator = new Animator(drawable);
          frame.addWindowListener(new WindowAdapter()
          {
                 public void windowClosing(WindowEvent e)
                 {
                    animator.stop();
                    System.exit(0);
                 }
          });
          frame.setVisible(true);
          animator.start();
   }


I’m running Win XP SP2 on a dell inspiron 8100 with an NVIDIA GeForce 2 Go graphics controller.

Any help on this would be greatly appreciated!

I don’t know which version of JOGL you’re running but it definitely isn’t the current one. Please try upgrading to 1.1 b10 and see if it fixes the issue you’re seeing.

You’re right, I wasn’t running the latest version when that error occuired. That is because, as I mentioned, I tried an earlier version of the jogl binaries when the one I was running caused an error. The error message when running with the latest binaries is the following:


net.java.games.jogl.GLException: java.lang.reflect.InvocationTargetException
at net.java.games.jogl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas
.java:225)
at net.java.games.jogl.GLCanvas.display(GLCanvas.java:75)
at net.java.games.jogl.Animator$1.run(Animator.java:107)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:834)
at net.java.games.jogl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas
.java:220)
… 3 more
Caused by: java.lang.NullPointerException
at net.java.games.jogl.impl.windows.WindowsGLContextFactory.getDummyGL(W
indowsGLContextFactory.java:168)
at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAn
dCreateContext(WindowsGLContext.java:288)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(Wind
owsOnscreenGLContext.java:230)
at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(Windows
GLContext.java:136)
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(Wi
ndowsOnscreenGLContext.java:76)
at net.java.games.jogl.GLCanvas$DisplayOnEventDispatchThreadAction.run(G
LCanvas.java:258)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Do the JOGL demos work?

I think there are remaining race conditions in the code in question that can arise when creating GLCanvas objects on multiple threads simultaneously. Is this what your application is doing?

I’ve tried some of the demos now, and no, the demos don’t work either. They give pretty much the same error message. By now I’ve reinstalled the j2re, the j2se sdk and the jogl binaries, and I’m even more confused.

Edit:
And no, that’s not what I’m doing if I understand you correctly. I’m not even creating any threads explicitly. Anyway, I guess that’s not the problem since the demos don’t work.

Clear out all jogl.jar, jogl.dll and jogl_cg.dll files on your machine. Clear out your PATH environment variable and put only the version of the JDK you want on it. Delete java.exe and javaw.exe from C:\WINDOWS\SYSTEM32. Then download and put jogl.jar and jog.dll on your CLASSPATH and PATH, respectively; do not drop them into the JRE. Make sure the current jogl-demos jars are also on your CLASSPATH. Then try running demos.gears.Gears again.

Wohoo! It worked! Thank you so much! :smiley:

I found I had to log off and on windows for the changes of the environmental variables to take effect. If I had known that, maybe I could have solved the problem earlier. Or maybe not. I still don’t know exactly what caused the problem though…

And now for something completely different:
As I was having trouble on my laptop, I installed jogl on a desktop Win XP pc with a Radeon 9600PRO graphics card. On my laptop the animator causes the display metod to be called 60 times per second, the same as my screen framerate. On the desktop however, display was called about 1400 times per second, and cpu usage went to 100%. I’ve also noticed this behavior on my laptop when the jogl graphics window is completely hidden behind other windows.
I’m not quite sure how the animator is supposed to work so I may be doing something completely wrong, but it still seems weird to me. Any suggestions?

Try checking your display driver’s settings
to see if vsync is explicitly turned off which
causes swapbuffers to execute immediately
instead of sync’ed to vertical retraces.
You can also use wglSwapIntervalEXT()
to control sync’ing to vertical retraces but
that will only work if the display drivers
are set to ‘application controlled’ of ‘default
on/off’.

Ok, thanks for the advice. VSync is turned on on my laptop, but I don’t have the desktop available right now to check out it’s settings. Anyway, since that isn’treally a problem by now I wont’ be making any effort on finding it out.

I’m posting to say I figured out what the problem was earlier. The problem was caused by the installation of Matlab v7.01. This installation added the text “C:\MATLAB701\bin\win32;” to the PATH environment variable. Removing this text and then logging off and on windows fixed the problem.

I’m not sure why jogl should crash because of that addition to the path though, as the directory doesn’t contain either java.exe, javac.exe, javaw.exe or any of the jogl files.