OpenGL 4 Java - MultiThreading problem
Hi all,
Trying to start my first animation in openGL for Java, I found that the openGL thread never stopped and that the WindowListener events could not occur until the animation is finished.
Here is the code (from this website) for the display method :
public void display() {
for ( int i=0 ; i<1000 ; i++ ) {
glj.gljMakeCurrent();
DrawGLScene();
glj.gljSwap();
glj.gljFree();
}
}
I tried to create separate Threads, to add a yield() and a sleep() in the loop, to give a minimal priority to the openGL thread, ... but I still can''t have my window suddenly closed while the animation is still running...
(Actually, the display() method is called implicitly once the GLAnimCanvas is built and the Frame containing it is shown, but from where is display() called, and is it possible to override the method calling it ???)
Any idea ?
I''m aware that this is perhaps more a multithreading question than an openGL one, but ...
Thanks for your help
(This openGL tutorial is great, the best I found on the net)
Not the answer you''re looking for, but GL4Java is pretty dead - the new Jogl project (http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl) is a very similar replacement, and being activly worked on. I had numerous problems with GL4Java but didn''t have many with Jogl.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement