Sign in to follow this  
lemons

SDL Frame Rate Regulation Flicker

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this