Loading...
Logo
Processing Forum
Hello,

Is there a way in processing to run a simulation loop faster than the frame rate? I have a simple physics engine I want to update about 100 times per second (easily done, just a few adds and multiplies) but update the according graphics at 15 or 20 fps at most (lots of stuff to render).

Thanks and regards,
Sebastian Mecklenburg

Replies(3)

you can render the simulation with 100fps by changing the frameRate(100);
and then put all the stuff you want to draw (also the background! ) between

if(frameCount%5==0){
background(0);
fill(255);
ellipse(.....)

}
Hey, nice. I didn't realize the draw() routine itself comes at so little cost.

Thanks and regards,
Sebastian Mecklenburg
Another option would be to use multithreading, but then you need to synchronize the Animation (draw) and your number-crunching thread.