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 › Problem with moving images
Page Index Toggle Pages: 1
Problem with moving images (Read 971 times)
Problem with moving images
May 5th, 2010, 2:35pm
 
i'm programming an interactive installation that has images animations, movements form one side of the screen to the other, occasionally.
i didn't expect problems with this, as it's so simple, but the results of the moving images are terrible – the images seems parted at some moments and the movement is not fluid as i expected.
first, i thought it was related to the big size of the images i'm using (some of them with 1000x2000px), but i decided to make a test with a little one (300x400px) and this short piece of code below:

Code:

PImage i;
int p;

void setup(){
 size(1024, 768);
 smooth();
 i = loadImage("img.jpg");
 p = -i.width;
}

void draw(){
 background(200);
 image(i, p, 100);
 p += 2;
 if(p > width) p = -i.width;
}


the result was the same, bad.
any tips? has someone already dealt with this?
Re: Problem with moving images
Reply #1 - May 5th, 2010, 8:32pm
 
I think I see what you mean, but that's just due to computers sucking at drawing graphics. The code itself is fine, and looks no worse than the same effect I get when dragging a window about my screen really fast.
Re: Problem with moving images
Reply #2 - May 6th, 2010, 5:12am
 
The problem is that you use the default mode, JAVA2D, which is a pure software mode, not the fastest.
Moreover, I feel that redrawing isn't synchronized with display (although I don't know if that concept has still a meaning with LCD screens).
If you use hardware graphics acceleration (ie., in Processing, OPENGL), you might see an improvement, but perhaps a lower quality...
Re: Problem with moving images
Reply #3 - May 6th, 2010, 5:43am
 
I did some quick tests on my pc
1. OPENGL has no visable influence in this case
2. Different frameRates (20,30,40,60) show significant different behaeviour in terms of "jitter" in the image.
>> For me it looks a little bit like a synch issue
Page Index Toggle Pages: 1