Jump to content
  • Advertisement
Sign in to follow this  
lemons

SDL Frame Rate Regulation Flicker

This topic is 3125 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 currently writing my own game engine with SDL, and I have a frame rate regulation system set up, but when I set the FPS to be 60, it has this blur, and flicker as the player moves. So say the player is being moved across the screen, it'll be overly blurry, and you'll see it jump back 5 frames or randomly cut out. Even with the SDL_DOUBLEBUF flag, as this is supposed to stop this from happening, this odd event still occurs. Any of you have any idea why this might be happening?

Share this post


Link to post
Share on other sites
Advertisement
Are you certain that when you create your surface that you passed the flag SDL_HWSURFACE as well? Because if you didn't, or double buffering could not be enabled for some reason, then SDL_Flip() will just result in an SDL_UpdateRect().

Some code would be helpful; how does it look without frame rate regulation?

Share this post


Link to post
Share on other sites
Hi there,

without seeing any of your code one can only say that you might have initialised your surface wrong. Not all video-flags are compatible. On the other hand it could be your algorithm to slow down the frames per second.

But ... if your image jumps BACK there is definitifly something wrong with your rendering functions...

If there is no DOUBLEBUF it should only apear to be flickering but not jumping back in position...

bless
bloody

Share this post


Link to post
Share on other sites
Hey I just suffered through this, and solved it.

Basically, when compiling on windows it refused to give me a hardware surface, even though I asked for one, even in fullscreen (only gives doublebuf in fullscreen). First I tried this:

putenv("SDL_VideoDriver=directx");

To force SDL to use directX as the backend. That made the game go realllllly slow for some reason, so after looking around some more I found that in one of the newer versions of SDL, you are able to create double buffers on software surfaces. Just get the most recent version (not the stable release one), and you should be good to go.

Don't worry about a software surface being slower then a hardware one, they are as fast of not faster.

Sounds like you have an additional problem in your own code, with the jumps in frames and cutting out, though.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!