Bug 1363 : redraw() doesn't work from within draw()
Last modified: 2010-06-05 03:30




Status:
ASSIGNED
Resolution:
-
Priority:
P3
Severity:
normal

 

Reporter:
PaulC
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-10-30 00:11
I am using Processing 1.0.9 and am trying to reduce unnecessary CPU load by
calling noLoop() and then drawing frames as required using redraw().
Although this generally works, I have a problem with some animations where
a state is updated during the draw() processing: I know that a new frame is
required but redraw() doesn't work from within the draw() method.

The reason for this is that in the PApplet.handleDraw() method the redraw
flag is called after draw() is called. If this line is moved to the start
of the enclosing block then redraw() works the same wherever it is called from.

It's *possible* to work around this in your own code, but this would be a
lot easier if this was fixed.

If you need help to implement this let me know, but it's really a trivial
change.
Additional Comment #1 From fry 2010-06-05 03:30
not entirely trivial, because this can get stuck in a recursive mess, but
i'll make a note of it to see if there's a way to handle the situation.
This bug is now being tracked here.