LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: CodeBunny on November 01, 2012, 13:37:43

Title: VSync is using lowest monitor refresh rate instead of the selected one.
Post by: CodeBunny on November 01, 2012, 13:37:43
[Not 100% certain this is the bug, but it certainly seems undesirable.]

My monitor has a couple of different refresh rates it can use - 50, 59, and 60 fps respectively. I have it set to refresh at 60 (the default rate).

However, it seems like when LWJGL goes fullscreen, the monitor starts refreshing at the lowest possible rate - 50 fps, in this case, instead of the 60 that I'm targeting. Thus, when I start using VSync, the game only allows 50 frames to execute per second because Display.update() blocks until the repaint.

Any idea why this is happening/how to fix?
Title: Re: [BUG] VSync is using lowest monitor refresh rate instead of the selected one.
Post by: Fool Running on November 06, 2012, 13:55:03
A couple questions:
1) Are you using VSync with Display.Sync()?
2) Is your monitor actually at 50 hz, or is it at 60hz but LWJGL is only drawing 50fps?
3) Without VSync are you able to get 60+ fps (i.e. it can actually draw 60 times per second)?
Title: Re: [BUG] VSync is using lowest monitor refresh rate instead of the selected one.
Post by: CodeBunny on November 06, 2012, 14:23:34
1: Yes. My standard game loop includes Display.sync(); the only modification I make to allow vsync is to set the flag in Display.
2: It seems like my monitor is actually running at 50fps - every frame looks perfect, it just allows fewer per minute.
3: Yes. I turn off vsync and it runs at normal speed - however, there is rather extreme tearing (6 frame updates are fit into 5 screen repaints).

I should also note that this is dependent on the monitor. I have a 2-monitor setup where the other has different display options (60 or 75 hz), and the problem does not occur when I use it as the primary display.
Title: Re: [BUG] VSync is using lowest monitor refresh rate instead of the selected one.
Post by: Fool Running on November 06, 2012, 17:56:49
If you take out Display.Sync when VSync is on, does the problem still persist (I would guess so, but I want to make sure to eliminate that possibility)?

How are you creating your display (Using the Display.Create with no parameters or specifying a display mode)? Have you tried doing the opposite?

Also, can you look at your monitor to double-check what Hz it is running at (i.e. looking at the monitor settings, not the settings in the OS)?

Sorry for so many questions, just trying to eliminate variables. ;)
Title: Re: [BUG] VSync is using lowest monitor refresh rate instead of the selected one.
Post by: CodeBunny on November 06, 2012, 20:53:55
Ah, got it. When selecting fullscreen modes, I wasn't ensuring the correct refresh rate. Thanks! :D