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