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 & HelpPrograms › processor overloading! can anyone help
Page Index Toggle Pages: 1
processor overloading! can anyone help? (Read 460 times)
processor overloading! can anyone help?
Jul 31st, 2006, 8:59pm
 
Hi,

I just started using processing to do a few reactive graphics experiments, and I have found it very intuitive and the instant feedback is incredibly useful. However, one of the applets I have created works fine, but it seems to consume a huge amount of processor power. I basically changes color dependent on where the cursor is placed in the applet window. I have tried putting it as an html, and as a .app (im using a mac), but unsurprisingly it makes little difference. If anyone has the patience, could you explain to me what has happened here? I don't really have any foundations of programming knowledge (being 16) but i would be very grateful for any assistance.

Josh

Here is the code:

void setup(){  
size(640, 480);
}

//the following constantly retrieves the mouse coordinates
void mouseX() {
loop();
}
void mouseY(){
loop();
}

//This part is supposed to make the blue levels dynamic too but instead I
//made them static because this block of code doesn't seem to work.
//if(mouseX > mouseY){
//  int blueLev = mouseX-mouseY;
//} else if (mouseX < mouseY){
//  color blueLev = mouseY-mouseX;
// loop();
//}

void draw() {
 background((mouseX/2), (mouseY/2), 153);
}
Re: processor overloading! can anyone help?
Reply #1 - Aug 1st, 2006, 7:45pm
 
processing will use as much processor as is available, and run your sketch as fast as possible. so for a very simple sketch, you're prolly getting a ridiculous frame rate and it's not doing much.

to slow it down (and not use up all available processor) use framerate(15) or framerate(30) or something.
Page Index Toggle Pages: 1