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.
IndexProgramming Questions & HelpSyntax Questions › Show multiple images during DRAW
Page Index Toggle Pages: 1
Show multiple images during DRAW (Read 791 times)
Show multiple images during DRAW
Dec 1st, 2009, 4:44pm
 
In normal operation the display is updated at the end/bottom of a DRAW function.  Is there a set of commands that permits building and displaying the drawing incrementally during one loop of DRAW?
Re: Show multiple images during DRAW
Reply #1 - Dec 1st, 2009, 10:57pm
 
Not in the way you would like, but a possible workaround:
(Supposing you have 3 steps you want to visualize)
Code:

int drawStep = 0;
void draw()
{
 if(drawStep == 0)
 {
   //Clear screen here, not outside this if/else structure
   draw1();
 }
 else if(drawStep == 1)
 {
   draw2();
 }
 else if(drawStep == 2)
 {
   draw3();
 }  
 drawStep = (drawStep+1)%3;
}
Re: Show multiple images during DRAW
Reply #2 - Dec 2nd, 2009, 3:48am
 
Used modulo function on frameCount within if statement to allow looping.

Thanks...
Re: Show multiple images during DRAW
Reply #3 - Dec 2nd, 2009, 5:13am
 
or instead of frameCount simply a variable that counts up everytime you press the mouse. so you get can switch the images on mousepress... it really depends on what you need
Page Index Toggle Pages: 1