Skip to main content
gamedev.net
🔒 Locked

Timing problem

Started by LorenSoth 8 replies 1.1k views
Original Post
LorenSoth
LorenSoth
hello all, I was using vertical sync and my fps was locked to 60 fps but now i disabled it and in the code section i calculate the time interval between two frames and then multiply the result with the speed of my object that have time in it but the problem is -> it is flickering ?? why is that ?? anyone have an idea ?? Thanks...
doynax
doynax
You're probably experiencing tearing since the program draws new frames faster than the video beam travels. So whenever they cross the screen displays two partial frames simultaneously.
LorenSoth
LorenSoth
hmmm i see, so how can i fix this problem ?
doynax
doynax
Quote:
Original post by LorenSoth
hmmm i see, so how can i fix this problem ?
Ehm, turn vsync back on? And maybe bump up your refresh rate too.
It's main purpose is to prevent tearing (well, decent implementations also conserve CPU usage).
Attempting to refresh the screen faster than it can display new images is mostly a pointless excercise anyway.
LorenSoth
LorenSoth
Quote:
Original post by doynax
Quote:
Original post by LorenSoth
hmmm i see, so how can i fix this problem ?
Ehm, turn vsync back on?
It's main purpose is to prevent tearing (well, decent implementations also conserve CPU usage).


But this is not the case, this is not that i want !
doynax
doynax
Quote:
Original post by LorenSoth
But this is not the case, this is not that i want !
Then what do you want?
It's physically impossible to get new images to the screen any faster than the monitor's refresh rate. So short of increasing that I really don't see anything you can do about it.

Never force a refresh rate other than the default though sice many monitors/drivers report the availability of unsupported ones. So either prompt the user with a dialog in a "safe" mode or let the user set a decent default themselves.
LorenSoth
LorenSoth
but cant it be programmed if i know the monitors refresh rate ?
doynax
doynax
Quote:
Original post by LorenSoth
but cant it be programmed if i know the monitors refresh rate ?
How to programatically set the refresh rate depends on what windowing library you're using. Since OpenGL doesn't actually specify how to set a display mode. It is generally possible though, so try looking for parameters with default values (0 is a likely suspect) in the function that set your fullscreen mode.
There's also many utilities around which can tweaking such settings manually. My NVIDIA driver came with one for example (try flipping trough the advanced propery pages of your display settings).

Unfortunately most LCDs and some (ancient) CRTs use fixed framerates.
LorenSoth
LorenSoth
but i think i did as you say by programatically i force to enable the vertical sync by opengl's extension EXT_swap_control ... Thanks for the support !
LorenSoth
LorenSoth
by the way i m using win32 and i can change it easily by the function ChangeDisplaySettings ...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.