Trouble with neHe tutorial 14 on os X?

Hi,

I looking at some of the NeHe tutorials on os X - at the moment 13 and 14. I imported tutorial 14 into eclipse 3.0 and ran it successfully - once. From now on, reboot or otherwise I get the following exception -

Error: view not ready, cannot lock focus at “src/native/jogl/MacOSXWindowSystemInterface.m:createContext:72”
net.java.games.jogl.GLException: Error creating nsContext
at net.java.games.jogl.impl.macosx.MacOSXGLContext.create(MacOSXGLContext.java:127)
at net.java.games.jogl.impl.macosx.MacOSXGLContext.makeCurrent(MacOSXGLContext.java:136)
at net.java.games.jogl.impl.macosx.MacOSXOnscreenGLContext.makeCurrent(MacOSXOnscreenGLContext.java:131)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
at net.java.games.jogl.impl.macosx.MacOSXOnscreenGLContext.invokeGL(MacOSXOnscreenGLContext.java:79)
at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:194)
at net.java.games.jogl.GLCanvas.display(GLCanvas.java:82)
at lesson14.GLDisplay$AnimatorTimerTask.run(GLDisplay.java:112)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)

I can still run all my own code and tutorial 13 successfully. The one thing I found looking at this forum is that there seems to be a problem in OS X with full screen mode? This is relevant because after running tutorial 14 successfully for the first time, I ran tutorial 13 in full screen mode, and saw only static text. Running 13 without full screen mode displays animated text. I am thinking perhaps that the full screen run of 13 has left something in a dodgy state? Tutorial 13 now runs both modes with animated text, so not sure what the original static text problem was, but it does seem very possibly related. Still pretty much a beginner at JOGL so I could be missing something obvious.

Has anyone else seen this error or successfully run the tutorial sequence above? Any pointers appreciated, thanks.

A quick note - if I comment out the line ‘frame.pack()’ then tutorial 14 runs correctly - albeit in a tiny window, but I can see the animated text in there. Put that line back and it crashes… also it doesn’t seem to be an eclipse problem, as an exported runnable jar exhibits the same behaviour outside this environment.

I’m not familiar with the particular demo, but this sounds an awful lot like the typical problem of adding and creating a JOGL canvas before the parent frame has been set visible. Look for the ordering of the frame.setVisible(true) and the canvas creation and addition to the parent frame (and thus pack()).