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 & HelpSyntax Questions › noLoop and loading an image
Page Index Toggle Pages: 1
noLoop and loading an image (Read 1391 times)
noLoop and loading an image
May 13th, 2005, 4:26pm
 
Hi,

I'm new here and the first thing I want to say is:Congrats to the creators of Processing and its contributors! It seems to be a wonderfull environment. Considering that I'm coming from C++ land, everything is so clean and simple Smiley

So, my question is, what the heck am I doing wrong with this very simple piece of code?

PImage b;

void setup()
{
 size(200,200);
 noLoop();
 b = loadImage("bg.jpg");
 image(b, 0, 0);
}

void keyPressed()
{
 redraw();
}

void draw()
{
 filter(BLUR, 2);
}

I can't imagine it's a bug, but can't see what I'm doing wrong either. I get all kind of strange errors about loading the image. As soon as I remove the noLoop statement, the code runs.

Thanks in advance,
vincent




Re: noLoop and loading an image
Reply #1 - May 13th, 2005, 6:37pm
 
Code:

void setup()
{
size(200,200);
b = loadImage("loren.jpg");
image(b, 0, 0);
noLoop();
}


can't explain why ... ben?

F
Re: noLoop and loading an image
Reply #2 - May 13th, 2005, 6:41pm
 
filed it as a bug:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1116002432;start=0

F
Re: noLoop and loading an image
Reply #3 - May 13th, 2005, 7:02pm
 
wow, my first simple tests and allready found a bug,must be friday the 13th Wink
Re: noLoop and loading an image
Reply #4 - May 13th, 2005, 7:52pm
 
You call image in the setup block. Call it in the draw block and it should work. I guess different from the old processing version, painting in setup is not possible
Re: noLoop and loading an image
Reply #5 - May 13th, 2005, 8:26pm
 
don't think so. since the basic mode is the same as wrinting all code into setup(){ ... } it should be possible to draw in there ...

F
Re: noLoop and loading an image
Reply #6 - May 13th, 2005, 9:13pm
 
If I move the image call to a different location, for example inside the draw funtion, I still get an error, although somewhat different.

I just discovered some other strange behaviour: every second time i try to compile the code, it *does* run without errors.
Re: noLoop and loading an image
Reply #7 - May 13th, 2005, 11:14pm
 
the code i gave above works ... have you tried that?

F


<< update >>

move noLoop() to the very end ...
Re: noLoop and loading an image
Reply #8 - May 14th, 2005, 12:12pm
 
yes, i can confirm that if i move the noLoop call to the end of the setup() function, the code works like i intended. thanks!

vincent
Page Index Toggle Pages: 1