We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Problem with OPEN GL (Read 904 times)
Problem with OPEN GL
Jul 4th, 2006, 12:47am
 
I'm using Processing 0115 on Mac OS 10.4.6 playing around with a little 3D animation triggered by keys or OSC messages. It works great using P3D, but with OPENGL I sometimes get java runtime exceptions. Looks like some timing problem. Is this a known issue?

Re: Problem with OPEN GL
Reply #1 - Jul 4th, 2006, 5:23pm
 
Maybe some explanation of my program helps finding the culprit.
It works basically like this

void draw() {
 ...
 if(...) {
   noLoop();
 }
}

void keyPressed() {
 if(keyCode==ENTER) {
   loop();
 }
}

I wonder if this is considered bad programming. The sporadic java exception seems to happen at the time when noLoop() is executed.

I'm getting the following error message:

java.lang.RuntimeException: java.lang.InterruptedException
 at processing.opengl.PGraphicsGL.requestDisplay(PGraphicsGL.java:239)
 at processing.core.PApplet.run(PApplet.java:1152)
 at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.InterruptedException
 at java.lang.Object.wait(Native Method)
 at java.lang.Object.wait(Object.java:474)

java.lang.RuntimeException: java.lang.InterruptedException
 at processing.opengl.PGraphicsGL.requestDisplay(PGraphicsGL.java:239)
 at processing.core.PApplet.run(PApplet.java:1152)
 at java.awt.EventQueue.invokeAndWait(EventQueue.java:846)
 at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:203)
 at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:237)
 at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
 at processing.opengl.PGraphicsGL.requestDisplay(PGraphicsGL.java:229)
 ... 2 more

Re: Problem with OPEN GL
Reply #2 - Jul 4th, 2006, 8:54pm
 
Seriously, turning loop on and off is bad juju. Change the test so that if it's false you don't draw anything (including background) and if true you do some drawing.. much better than turning loop on and off.
Re: Problem with OPEN GL
Reply #3 - Jul 4th, 2006, 9:34pm
 
Thanks for confirming my suspicion.
I thought to save some cpu cycles but the gain is in fact negligible.


Re: Problem with OPEN GL
Reply #4 - Jul 5th, 2006, 2:52pm
 
http://dev.processing.org/bugs/show_bug.cgi?id=164
Re: Problem with OPEN GL
Reply #5 - Jul 5th, 2006, 7:05pm
 
Ok, so it's quite interesting that my (ugly) pattern works at all sometimes.
Maybe this helps to isolate the issue...




Page Index Toggle Pages: 1