Is There A Way To....

Is there a way to control/set the monitor’s refresh rate through Panda APIs? or even better, the Config.PRC file :question:

------Update------------------

I asked this question because I was experiencing that flickering/jarring of the screen again. I was thinking it was a code issue and started modifying code. Then I set the V-Sync to false and I noticed the flickering/jarring of the screen eased up a lot.

That’s when I had a theory the issue was the refresh rate of the monitor. That’s why I wanted to know if there was a way to set the monitor’s refresh rate, but that’s not needed.

What I did was set the game’s fps to match that of my Monitor. I had the game V-Synced at 60, but never realized my monitor has a fixed refresh rate of 59 I believe (24 inch monitor).

When I set the game fps to 59, everything was perfect! No flickering/jarring of the screen.

I had know idea going just 1 fps OVER a monitor’s refresh rate would cause so much havoc.

Lesson learned.

I don’t know what you mean by “setting your game’s fps.” If you keep video-sync enabled in your Config.prc file, then your graphics driver will automatically match your monitor’s sync rate. This actually has nothing to do with Panda itself.

There’s no way to programatically change the sync rate. It would be theoretically possible if you open a fullscreen window, but Panda doesn’t provide an interface for this. It’s usually not that important.

David

ffFPS = 59 
globalClock = ClockObject.getGlobalClock() 
globalClock.setMode(ClockObject.MLimited) 
globalClock.setFrameRate(ffFPS)

That is how I set the game to run at 59. And no, V-Sync did not set my fps to match my monitor because I have an fps reader and I was always at 60 until I set the fps manually. Keep in mind, every monitor is different and that goes for access through APIs as well.

Which is the reason why large commercial game compaines detect the monitor type/brand and go from there.

that is because your screen refreshes with 60Hz. so you get 60 fps with v-sync on. so it worked as advertised.

that would be news to me.

The above code doesn’t really change your game’s rendering fps. It just forces it to wait for one out of every 60 frames, on average. As Thomas said, if video-sync locked you at 60 fps, then your monitor is indeed running at 60 Hz. That is actually a very common refresh rate for LCD monitors; I’ve never seen an LCD monitor that synced at any other rate. I’ve certainly never heard of one that syncs at 59 Hz.

David

I guess people don’t read well at times. My screen does not refresh at 60, it refreshes at 59 only. That’s the only refresh rate my monitor has…59.

That’s the reason I had to manually set the game to run at 59 in order to stop the bad visual effect.

I’ve played commercial games in the past that even showed me the type of monitor I had when adjusting the refresh rate. Detecting the monitor shouldn’t be news for anyone, because that’s old news.
I even had a 22 inch monitor that had multiple refresh rates you could set. There’s no way to know what a monitor has unless you detect it correctly, that’s what APIs are for.
Peace.

:wink:

Discovered a new behavior. It turns out I had to set my Game’s Global Clock to match the target frame rate. I tested this by not setting the Game’s Internal clock with V-Sync on and I received the poor visual effect. After setting the Game’s Internal Clock, with V-Sync still on, the poor visual effect disappeared.

Just to be on the safe side of things, I’m going to allow a player to select the approbiate refresh rate of their monitor and have the Game’s Internal Clock set to that value. By default I will have the internal clock at since most monitors are not like mine and low at 60.

Don’t know why I’m experiencing this effect, Global Clock has to be set along with V-Sync, but as long as I have to solution, no fears.

I tested this on one of my 60 low rate monitors. It works!