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 › Scroll large image
Page Index Toggle Pages: 1
Scroll large image (Read 652 times)
Scroll large image
Sep 23rd, 2008, 8:34pm
 
Hi there,

What is the best way to smoothly scroll a large image. If I use a class like this for movement the screen updates in a very jerky way. Please help. Thanks


class Glider{
 float x,y;
 float glWidth;
 float glHeight;
 float speed;
 float yAccel;
 float yGrav = 0.01;
 float yVelo = 0;

 //Constructor
 Glider(float xpos, float ypos, float Wid, float Heig, float acc){
   x=xpos;
   y= ypos;
   glWidth = Wid;
   glHeight = Heig;
   yAccel = acc;
 }

 void move(){
   
  yAccel = yGrav;
  yVelo = yVelo + yAccel;  
   y = y + yVelo;
       
   if (y > 300) {
     yVelo = -yVelo ;
   }

   image(PersonImage, x,y, glWidth, glHeight);
 }
}
Re: Scroll large image
Reply #1 - Sep 24th, 2008, 2:14pm
 
I understood from other discussions that with large images, it is quite hard to avoid jitter. Looks like the update of the display should be synchronized with screen's refresh rate.

Mmm, searched back the discussion: how to solve tearing With double-buffering?Vsync
Looks like there is a solution after all.
Page Index Toggle Pages: 1