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 › Performance Measured vs. Bitmap Size
Page Index Toggle Pages: 1
Performance Measured vs. Bitmap Size (Read 1334 times)
Performance Measured vs. Bitmap Size
May 5th, 2005, 10:17pm
 
I am using the default size command size(x, y) and noticed a severe penalty on interactive performance. As bit map size increased CPU utilization dramatically rises to the point that mouse inputs are undersampled.

The following images illustrate this, consecutively drawing a figure eight on simulated engineering paper:


20 dpi, 160 x 216 pixels:
...

40 dpi, 320 x 432 pixels:
...

60 dpi, 480 x 648 pixels:
...

It is not possible to draw on bitmaps larger than this interactively. The CPU just locks up.

This bug prevents the app from reaching the target image size of 992 x 1340.

When size(x, y, P3D) or size (x, y, OPENGL) is used interactive performance returns to normal FOR ALL SIZES, but with loss of background, to wit:

size(x, y, P3D) 160 x 216 pixels:
...

size(x, y, OPENGL) 160 x 216 pixels:
...

The .pde file to reproduce these examples is here.
Re: Performance Measured vs. Bitmap Size
Reply #1 - May 5th, 2005, 11:22pm
 
the size() command needs to go into void setup() for it to work properly.

Code:

void setup()
{
size(480, 648,OPENGL);

// Note change only this dpi argument to EDPaper to show bug.
EDPaper eDPaper = new EDPaper(60); // units are dpi

eDPaper.drawPaper("Van Warren", "Processing Beta Test", "5/4/2004" );
}
Re: Performance Measured vs. Bitmap Size
Reply #2 - May 6th, 2005, 3:39am
 
Also, FYI size() will wipe out some object Processing data structures (like colors) it seems... try the following:

Code:
void setup()
{
//HACK: Set the screen width and height(primitives)
EDPaper eDPaper = new EDPaper(60); // units are dpi

// Really, this should be first in setup()
// Odd things happen when it's not.
size(eDPaper.screen_Width, eDPaper.screenHeight, OPENGL);

//HACK: So reinitialize our paper after setting the size
eDPaper = new EDPaper(80); // units are dpi

// um... everything else as usual
eDPaper.drawPaper("Van Warren", "Processing Beta Test", "5/4/2004" );
}

Re: Performance Measured vs. Bitmap Size
Reply #3 - May 7th, 2005, 4:12am
 
yup, size() has to go at the very beginning of setup() (now noted in the docs, this is different between alpha and beta), because it reloads the graphics context entirely (because it can't know whether you want opengl, java2d, etc before your app starts and has to build them dynamically).
Page Index Toggle Pages: 1