Skip to main content
GameDev.net gamedev.net
🔒 Locked

Frame Rate Booster

Started by phaneb2003 Dec 27, 2003 at 5:18 AM 18 replies 1.5k views
Original Post
phaneb2003
phaneb2003
I have created a OpenGL rendering context over a window, but whatever the window size is, the framerate is limited to 70 fps. I have noticed that this number is exactly my driver refresh rate (I have an NVidia Geforce4 MX). How can I exceed that frame rate (I''m sure my video card can do better . Thank you! Stefan Bucur
Stefan Bucur
desertcube
desertcube
You need to disable V-Sync. It should be in your driver options somewhere, can''t remember as I have an Radeon now. You can get there either through control panel or right click on your desktop and goto properties, then click on settings and then click the advance button and look through all the options there.
Hope this helps.
phaneb2003
phaneb2003
Thanks man, it really worked. However, this setting was under OpenGL tab of my setting window. Do you know whether I can disable it programatically? Or is it reccomended to disable it?

Stefan Bucur
Stefan Bucur
Fidelio66
Fidelio66
The user can specify what he wants. It would be unfriendly to go against what he wants and to overrule that anyway.
phaneb2003
phaneb2003
I''ve asked the question because under Vertical Sync label on my driver settings I have three options: On by default, Off by default, and Always Off, and I thought that one application can disable or enable it to pursue its needs (e.g. benchmarks applications).

Stefan Bucur
Stefan Bucur
_the_phantom_
_the_phantom_
it is possible to disable it from within a program, its one of the WGL extensions in windows.

However, as has been said dont disable it by default in your program if you plan on releasing simply because not everyone like tearing gfx and prefer to run with v-sync on
Chacha
Chacha
quote:
Original post by phaneb2003
Do you know whether I can disable it programatically?

It definitely is possible to enable/disable V-Sync programatically, although I can''t help you there.

quote:
Original post by phaneb2003
Or is it reccomended to disable it?

Everyone has their own opinion on V-Sync, some people prefer it on, while others leave it off. But be aware that with V-Sync disabled, there is a chance of the "tearing" effect coming into play.
Xiachunyi
Xiachunyi
This should work:

#include <gl\wglext.h> //Header File for WGL Extensions

...
//===Check Ext. List to see if supported by vid card===

//Check Extension List for required Extension::Dave Astle

bool CheckExtension(char* extensionName)
{
char* extensionList = (char*) glGetString(GL_EXTENSIONS);
if (!extensionName || !extensionList)
{
return false;
}
while(*extensionList)
{
unsigned int firstExtensionLength = strcspn(extensionList, " ");
if(strlen(extensionName) == firstExtensionLength && strncmp(extensionName, extensionList, firstExtensionLength) == 0)
{
return true;
}
extensionList += firstExtensionLength + 1;
}
return false;
}
===Implementation===
//~~~~See if we can utlize this to disable V_SYNC

if(option[0].v_sync)
{
if(CheckExtension("WGL_EXT_swap_control"))
{
pwglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT");
}
else
{
LoadString(hInstance,ID_STRING_ERROR_2,global.text_var,256);
MessageBox(hwnd,"\"WGL_EXT_swap_control\" unsupported! (V-Sync On)",global.text_var,MB_OK);
}
}
//~~~~Disable V_Sync

if(option[0].v_sync)
{
if (pwglSwapIntervalEXT)
{
pwglSwapIntervalEXT(0);
}
}


The option[0].v_sync logic statement can be omitted but that is there in my program to let the user decide if he/she wants to disable v-sync or not.

Hope that helps.
Raloth
Raloth
Why would you want to disable vsynch? You won''t actually see thoes extra frames per second past your refresh rate and the tearing will drive some people insane.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Caminman
Caminman
quote:
Original post by Raloth
Why would you want to disable vsynch? You won''t actually see thoes extra frames per second past your refresh rate and the tearing will drive some people insane.


Guess it might be useful when tweaking your code and seeing the actual results, instead of a constant framerate of 70 ?
_the_phantom_
_the_phantom_
benchmarking like that is about the only good reason i can think of for turning of v-sync, and then most drivers give you an option to disable it anyways..
psykr
psykr
I don''t think you should be forcing vsync when you ship your game. If the end user has vsync set, then he will just get annoyed when you disable it. If you''re afraid that the user won''t know how to change the vsync status, then they probably wouldn''t know why they want to change it anyway.
dmounty
dmounty
A much better use of that extra performance is to use the extra time for CPU intensive calculations. If the framerate is being held back by waiting for the V-Sync then you have plenty of time to do lots of CPU intesive calculations that won''t affect the framerate at all. If you just want to test the framerate.. then run it single buffered.
merlin9x9
merlin9x9
As Raloth suggested, turning off vsync is not the answer. If you want a higher potential framerate, just set the refresh rate to something higher when you change the display mode for your application.
Dredge-Master
Dredge-Master
when vsync is off, it is great at higher frame rates, but consider this.

Unless you are only testing (for benchmarking your code) leave it on.
Even then, aslong as you move your framerate measurements to BEFORE the swap buffers call you will get the same hertz minus the speed of your DAC. This will go up above 70 easily, and it''s the real time that it took to render your image, not the rendering+blitting.
The only time it is necessary is if your game is frame rate dependant for things like moving. And that is a REALLY bad thing.
Even on Street Fighter 2 on my old 286 I noticed a big difference in the movements (twice as fast) when turbo was on. It had great software emulation of turbo though.
So DON''T disable it as programatically its bloody useless.

For leaving it on:
Your screen wont tear (especially at lower frame-rates this looks like crap when you have a line across the top third of your screen).
You can use it for animation rendering recordings (with vsync disabled you get tearing recorded in your video).
It will take up less CPU time for the same performance.


The gist is, unless you need it for frame based animations or REALLY BAD frequency (frames per second) measuring, leave it on.

If you are using it for that "REALLY BAD frequency (frames per second) measuring" expect to fail at university, college, or any other training institute.
Beer - the love catalystgood ol' homepage
sBibi
sBibi
quote:
Unless you are only testing (for benchmarking your code) leave it on.


quote:
benchmarking like that is about the only good reason i can think of for turning of v-sync


mmhh.. most hardcore (mainly Q3) gamers I''ve seen are ready to do anything to get the highest possible framerate, way above 150 (or even 200) fps.
I don''t really think that''s just for "fun" or just to say "look I''ve got a higher fps than you". and most of the time, that is done by crushing down visual quality... lowering texture filters, run with lightmaps only, or textures only with no lighting, sprites instead of items, etc...

of course, graphically, it isn''t necessary and it adds nothing to have an fps higher than the monitor refresh rate, _but_ I guess gameplay isn''t the same at 200 fps than at 75-80. that would be mainly because of game input.

actually, I haven''t seen a great difference in gameplay, but I''m no hardcore gamer...

just wondering...
The Flood
The Flood
quote:
Original post by Dredge-Master

For leaving it on:

You can use it for animation rendering recordings (with vsync disabled you get tearing recorded in your video).





You should also leave it on if you are taking screenshots with another program (eg Paintshop)
jermz
jermz
quote:
Original post by sBibi

mmhh.. most hardcore (mainly Q3) gamers I''ve seen are ready to do anything to get the highest possible framerate, way above 150 (or even 200) fps.
I don''t really think that''s just for "fun" or just to say "look I''ve got a higher fps than you". and most of the time, that is done by crushing down visual quality... lowering texture filters, run with lightmaps only, or textures only with no lighting, sprites instead of items, etc...

of course, graphically, it isn''t necessary and it adds nothing to have an fps higher than the monitor refresh rate, _but_ I guess gameplay isn''t the same at 200 fps than at 75-80. that would be mainly because of game input.



With Q3 based games, theres the famous case of the physics actually being different and allowing you to jump higher at certain frame-rates (43, 76 and 120 IIRC). There is also the case of input, with some games sampling only after each frame. 70 fps will give you under 15 ms for each frame. I personally top out at about a 40 ms reaction time but some hard-core competitive gamers may find 70 fps restrictive, especially if they experience a slight stutter that causes a refresh miss and doubles the response time up to 30 ms.

shurcool
shurcool
I, as a gamer, always leave v-sync off. :/

Too bad this doesn''t affect me all that much, because I have a P3 500 MHz and rarely get FPS over 85 (the refresh rate of my 17" LCD monitor).

---
shurcooL`
Dredge-Master
Dredge-Master
quote:
Original post by The Flood
quote:
Original post by Dredge-Master

For leaving it on:

You can use it for animation rendering recordings (with vsync disabled you get tearing recorded in your video).





You should also leave it on if you are taking screenshots with another program (eg Paintshop)


I''ve never even thought of that until now (ever since I found the tearing, I leave vsync on). Very good point!
Beer - the love catalystgood ol' homepage

Topic Locked

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

Sign in to reply to this topic.