Bug 508 : setup code called twice if above call to size()
Last modified: 2007-01-29 19:06




Status:
RESOLVED
Resolution:
INVALID -
Priority:
P2
Severity:
normal

 

Reporter:
mangtronix
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2007-01-29 19:00
Revision: 0123
Operating System: Windows XP SP2

Description: If there is code above the call to size inside setup() with
P3D (only) it appears to be run twice. That's very weird. Bug in the
preprocessor? This only happens with P3D, and only for code above the call
to size. Probably your call to size should be first anyway, but if you
have code above it's surprising for it to run twice.

Sample code:

int timesRun = 0;

void setup() {
++timesRun;
println("Setup: " + timesRun);
size(300, 300, P3D); // This only happens with P3D!
println("Exiting setup");
}

Sample output:
Setup: 1
Setup: 2
Exiting setup
Additional Comment #1 From fry 2007-01-29 19:06
this is why the size() method MUST GO FIRST inside setup(). this is stated
as such in the reference, and oft-repeated on the board.

that's not a bug, that's how we're able to do things like change the
renderer to OPENGL on the fly, from inside of a program and inside a method
that does actual drawing.