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 & HelpOpenGL and 3D Libraries › Out of memory loading images. OpenGL Bug
Page Index Toggle Pages: 1
Out of memory loading images. OpenGL Bug? (Read 687 times)
Out of memory loading images. OpenGL Bug?
Jul 27th, 2006, 11:04pm
 
Hi,

I posted something about this issue some time ago in another topic but didn't have any example to show. Now I managed to create a very simple sketch which explodes with an out of memory exception in GL after a couple of minutes running. It loads 2 images (700Kb bmps) in loop. If I run it in P3D it runs smoothly.

Here's the code:
-----------
import processing.opengl.*;

PImage bitmap;
int flag = 0;

void setup()
{
 size(640, 480, OPENGL);
 framerate(10);
}
void draw()
{
 if (flag==1)
   bitmap = loadImage("a.bmp");
 else
   bitmap = loadImage("b.bmp");
 flag = 1-flag;
 image(bitmap, 0, 0);
 println(millis());
}
-----------

Please advise.

Thanks,
Nuno
Re: Out of memory loading images. OpenGL Bug?
Reply #1 - Jul 28th, 2006, 1:48am
 
as recommended in the reference, don't use loadImage inside draw(). also see the second faq item under the opengl section:
http://processing.org/faq/bugs.html#opengl
Re: Out of memory loading images. OpenGL Bug?
Reply #2 - Jul 29th, 2006, 10:34am
 
Hi Fry,

Thank you for your reply.

Hum... I cannot avoid loading images during draw() because I have a pool of over 200 BMPs around 700Kb each and so it is completely impossible to pre-load them!

Flash: I already implemented it in Flash but it will not do because it doesn't use hardware acceleration and the result is not smooth at all.

P3D mode: I need to rotate the images and, while in OPENGL mode this works fine, in P3D after rotation they get all jagged. BTW, is there a way to turn anti-alias on in P3D? Anyway, in this mode the result is somewhat jumpy, like Flash, and I really need it to be veeeery smooth.

Any other ideas to solve this in Processing? Otherwise I'll have to find an alternative to Processing (which I love). Sad((

Thanks again,
Nuno
Page Index Toggle Pages: 1