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
how does processing work (Read 2146 times)
how does processing work
Aug 12th, 2008, 6:02pm
 
I'm just curious how processing work internally. How is the draw function implemented? Is it a Thread that will constantly loop or some sort of call back function? Where can I find some info about that?
Re: how does processing work
Reply #1 - Aug 17th, 2008, 11:14am
 
Just look at the code? It is available in the Contribute section with SVN client and online viewing.
Re: how does processing work
Reply #2 - Aug 18th, 2008, 1:17am
 
A main Processing thread loops through draw() as quickly as it can execute the method. How fast it can execute all the code executed in the draw method controls the sketch's frame rate, usually expressed in frames per second. You can lock the frame rate to a lower frame rate than would naturally occur with the frameRate() method, prevent looping with noLoop(), and start and stop looping with other methods.

A separate thread watches for user input events. Event handler methods in Processing capture these events and set various variables, like mousePressed, for the next execution of draw(). In some cases, they also invoke call back methods such as mousePressed() that you can override with your own custom logic.
Page Index Toggle Pages: 1