GLException: Surface already unlocked

Hello,

disclaimer: I’m new to OpenGL and fairly new to Java so don’t shoot me!

I’ve got a little 3d drawing program running. It just draws triangles to build up 3d objects. I’ve got a class called GLEngine which has my init, display, reshape, etc. in it that extends frame. Etc. pretty much like the examples all around.

After the constructor completes I get this error:

[quote]net.java.games.jogl.GLException: Surface already unlocked
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.unlockSurface(WindowsOnscreenGLContext.java:192)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.free(WindowsOnscreenGLContext.java:134)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:182)
at net.java.games.jogl.GLCanvas.display(GLCanvas.java:82)
at net.java.games.jogl.Animator$1.run(Animator.java:104)
at java.lang.Thread.run(Thread.java:534)
[/quote]
Here is the constructor:


      public GLEngine(Polygon3D p, double[] VRP, double[] VPN, 
                              double[]VUP, double[] PRP, 
                              double uMin, double uMax,
                              double vMin, double vMax, 
                              double nMin, double nMax) {
            // init Frame
             super ("Simple 3D with JOGL");
             System.out.println ("constructor");
             
             myPoly = p;
             look = VRP;
             uvn = VPN;
             up = VUP;
             eye = PRP;
             left = uMin;
             right = uMax;
             bottom = vMin;
             top = vMax;
             near = nMin;
             far = nMax;
             System.out.println ("constructor: constants");
             // get a GLCanvas
             GLCapabilities capabilities = new GLCapabilities();
             System.out.println ("constructor: capabilities instanctiate");
             GLCanvas canvas =
                   GLDrawableFactory.getFactory().createGLCanvas(capabilities);
             System.out.println ("constructor: canvas factory");       
             // add a GLEventListener, which will get called when the
             // canvas is resized or needs a repaint
             canvas.addGLEventListener(this);
             System.out.println ("constructor: add listener");
             // now add the canvas to the Frame.  Note we use BorderLayout.CENTER
             // to make the canvas stretch to fill the container (ie, the frame)
             add (canvas, BorderLayout.CENTER);            
             System.out.println ("constructor: add canvas to frame");             
             canvas.requestFocus();       
             System.out.println ("constructor: req focus");                          
             
            animator = new Animator(canvas);
            animator.start();
            System.out.println ("constructor: animator");

                  
            this.addWindowListener(new WindowAdapter()
                  {
                    public void windowClosing(WindowEvent e)
                    {
                        animator.stop();
                  
                    }
                  });
            System.out.println ("constructor: anon window listener");
      }

Any ideas?

Thanks,

Jim

Your application may have a bug which is causing the OpenGL state to become corrupted. Try using the DebugGL as documented in the JOGL User’s Guide (linked to from the JOGL home page) to see if you can narrow down the error.

It’s also possible that JOGL should be reporting a better exception. If you can boil this down to a test case I’d be interested to see it.

I’ll try to figure out how to catch the added debug info.

Was just wondering generically what a ‘Surface already unlocked’ error may mean.

Also, I cannot contribute any direct problem with rendering due to this exception. I do have some other problems but will ask those in seperate post.

Thanks,

Jim

Not sure if this is the case for you, but I got this exception when my Animator was started before the enclosing Frame was shown. This would happen on WinXP but not on Linux.

Sean

This was the case. Thanks,

Jim