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 › Delay executing unexpectedly
Page Index Toggle Pages: 1
Delay executing unexpectedly (Read 531 times)
Delay executing unexpectedly
Feb 10th, 2006, 5:35am
 
I'm having problems with the delay function call - it appears to execute before it should!  Here's the program structure:
//-----
void draw()
{
 for (int i...etc..
 {
  draw n frames with i polygons each - the final
  frame in this sequence is flagged with the boolean
  lastbump
 }

 if (lastbump) // check for last frame in sequence
 {
 reset data & flags etc. for next frame
 delay(1000);
 }
}

Problem is the delay executes before the stuff in
the drawing loop is finished.

Is there any way I can force Processing to finish
drawing before the delay is called?  Or should I
be using an alternative structure?  (I'm not using
the OOPs features BTW.)
Re: Delay executing unexpectedly
Reply #1 - Feb 12th, 2006, 3:15am
 
Paul,

From what I understood from your email, Processing shouldn't behave that way. It's curious.

Have you tried using framerate() instead of delay to display the images slowly. For example, instead of delay(1000) at the end of draw, you could call framerate(1) inside setup.

Casey
Re: Delay executing unexpectedly
Reply #2 - Feb 12th, 2006, 10:20am
 
Casey - thanks for your response.

I'm using framerate to control the overall frame speed.  Then every 100 (say) frames I want to hold the screen for 1 Sec and use the delay call.  I've got it to work with a kludge - putting the delay call after the first frame of the next sequence & it works OK.  Am still testing to make sure it's not a logical error in my code - will get back to you.

Paul
Page Index Toggle Pages: 1