Sign in to follow this  

Recommended Posts

Hi, I have a program where I draw various things onto the screen. One of them is a fps counter. Normally, when vsync is turned on, the framerate is about 59fps. When I turn it off, it jumps to the 100-200fps range. I have set it to its default setting ("Let the 3D application decide") and I now need to know HOW TO let OpenGL decide. Is there a function I need to call? G

Share this post


Link to post
Share on other sites
Quote:
Original post by Geometrian
Hi,
I have a program where I draw various things onto the screen. One of them is a fps counter. Normally, when vsync is turned on, the framerate is about 59fps. When I turn it off, it jumps to the 100-200fps range. I have set it to its default setting ("Let the 3D application decide") and I now need to know HOW TO let OpenGL decide. Is there a function I need to call?
G
It's an extension function called wglSwapInterval.

Share this post


Link to post
Share on other sites
This is how I do it.


/*
================================================================================
SetVSync() : VSync on / off
================================================================================
*/

void SetVSync(bool pSync)
{
typedef bool (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);

PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;

wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");

if( wglSwapIntervalEXT )
wglSwapIntervalEXT(pSync);
}




Then call SetVSync( true or false ); in the Initialise process.

Good luck, Cheers!

Share this post


Link to post
Share on other sites
Great, this looks like exactly what I need. However, I don't know C++ very well, so I can't tell exactly what that's doing. If you could tell me which functions to call in what order, I could probably figure it out.
Thanks for your response.
G

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