I've been working on a JOGL application using active rendering. I've based a lot of it off of Andrew Davison's chapter on JOGL (http://www.java-gaming.org/forums/index.php?topic=12512.0
). He extends an AWT Canvas to create the class that has the thread that does all the GL rendering, but wraps it in a JPanel. I tried to create one class, extending JPanel, to handle the GL rendering thread. I created a Canvas as an instance variable in that classand added it to the panel. Then I add my custom, threaded panel to a JFrame. But whenever I try to make the context current to make GL calls, a GLExeption is thrown:
Exception in thread "Thread-2" javax.media.opengl.GLException: Unable to lock surface
(I called my JPanel RenderJPanel).
Some of my code:
private void makeContextCurrent()
public void run()
I'm not creating any other threads in the program, o I don't see how the context could already be current on a different thread. The javadoc says the exception can also be thrown due to "non-recoverable, window system-specific errors." That doesn't help me much though.
Is there a problem with combining the JPanel and the Canvas in the same class? Anything else I'm doing wrong? If more code would be helpful, I can post it too.
Thanks for the help in advance.