Jump to content
  • Advertisement
Sign in to follow this  
AdamGL

OpenGL Smooth Scrolling

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a 2d game, and I have a textured Quad that is representing the main character. When I move him across the screen, pixel by pixel, he seems to shudder as he moves and its all shaky. Is there a way to smooth things out in OpenGL?

Share this post


Link to post
Share on other sites
Advertisement
Can you be more specific- what's your drawing code? Are you using ortho projection? How are you moving it pixel by pixel?

One thing that comes to mind is varying frame rate. If the framerate suddely dips or spikes for any reason, your quad is suddenly going to lag/jump ahead if you are moving it by incrememnting its position by a fixed amount per frame. You can look into time based or frame based movement to overcome this.

Share this post


Link to post
Share on other sites
That kind of thing usually happens when you don't have VSync enabled. Try enabling it and see if it goes away.

Share this post


Link to post
Share on other sites
Alright, When I move him pixel by pixel(Translate over 1 pixel and draw the textured quad) in Orthographic mode, he blurs a little and then shudders occasionally. In games like super mario, he never blurred and he was smooth. I don't think v-sync has anything to do with it if they didn't have v-sync when super mario brothers was out(at least i think).

Share this post


Link to post
Share on other sites
Hmm, the shuddering sounds like variabe framerate as I mentioned, but the blurring I'm not so sure about. Do you have an .exe we can see?

Plus some answers to these might help us:
1. Do you move the quad 1 pixel every frame?
2. Do you limit the number of frames per second, or just the main loop just execute as fast as it can?

Share this post


Link to post
Share on other sites
It sounds a lot like that you don't have pixel perfect alignment on your quad drawing. The blurring part makes is sound like some of the time you're only moving him a fraction of a pixel.

Share this post


Link to post
Share on other sites
The per pixel movement is how fast the loop executes it. I press left or right to move the guy and when I hold the key down, he doesn't move properly. The .exe is below(the guy doesn't have legs yet).

Click Here

I'm leaving for about a week so I won't be able to answer for a while. If you want to ask some more questions, PM me because the thread will dissapear from the front page over time. :) Thanks for the help guys!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!