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 › massive fps drop on loadPixels
Page Index Toggle Pages: 1
massive fps drop on loadPixels (Read 592 times)
massive fps drop on loadPixels
Feb 21st, 2006, 7:31pm
 
Hi,

We have a problem with loadPixels. We load an image and show it to the stage. As soon as we make a single loadPixels, fps drops from 250 to 16...  even without not doing anything with pixels.

We've looking for some examples like using System.arraycopy using the global g to load the buffer, but we don't really understand how this function works or how this could help us.
Here's the sample (and dumb) code as example:
Code:

void setup(){
 img = loadImage("http://www.google.es/logos/olympics06_curling.gif");
 size(img.width,img.height);
}
void draw(){
 image(img,0,0);
}
void keyPressed() {
 if(key == CODED) {
   if (keyCode == UP) {
     loadPixels();
   }
 }

As soon as we make the loadPixels, it drops from 700 to 100 fps and it stays like that.

Thanks!
Re: massive fps drop on loadPixels
Reply #1 - Feb 21st, 2006, 7:55pm
 
loadPixels() is extremely slow when using the default Java2d renderer. If you can, use P3D as argument for size() since this will be alot faster.

Code:
size(img.width,img.height,P3D); 

Re: massive fps drop on loadPixels
Reply #2 - Feb 21st, 2006, 8:20pm
 
this is also the first item in the "drawing in 2D" section of the faq:
http://processing.org/faq/bugs.html#java2d
Re: massive fps drop on loadPixels
Reply #3 - Feb 22nd, 2006, 11:01am
 
I've tried it and it works perfect! It stays at 50fps all the time.

Thanks!  : )
Page Index Toggle Pages: 1