This is a strange one... It took me a while to figure out what it was and it applies to all graphic rendering modes. It seems that whenever there are classes involved, the graphic window freezes on my machine when being moved around. Not necessarily when moved out of screen bounds or hidden behind other windows. Just moved around.
This works:
Code:
void setup(){
size(200,200);
framerate(25);
}
void draw(){
if(random(9)<1) {
background(200);
print(".");
}
rect(random(191),random(191),9,9);
}
..and so does this:
Code:
void setup(){
size(200,200);
framerate(25);
}
void draw(){
if(random(9)<1) {
background(200);
print(".");
}
update(random(191),random(191));
}
void update(float xp, float yp){
rect(xp,yp,9,9);
}
But, this
does not:
Code:
rekti rekt = new rekti();
void setup(){
size(200,200);
framerate(25);
}
void draw(){
if(random(9)<1) {
background(200);
print(".");
}
rekt.update(random(191),random(191));
}
class rekti{
rekti(){
}
void update(float xp, float yp){
rect(xp,yp,9,9);
}
}
..and strangely enough,
neither does this:
Code:
// rekti rekt = new rekti();
void setup(){
size(200,200);
framerate(25);
}
void draw(){
if(random(9)<1) {
background(200);
print(".");
}
// rekt.update(random(191),random(191));
rect(random(191),random(191),9,9);
}
/*
class rekti{
rekti(){
}
void update(float xp, float yp){
rect(xp,yp,9,9);
}
}
*/
..even though all class related lines are commented out. Passing a "this" to the class makes no difference.
The dots are happily printed, even though graphic rendering freezes. And the freezing happens only when the graphic window is moved. Minimizing makes no difference and neither does arranging other windows in front.