Jump to content
  • Advertisement
Sign in to follow this  

This topic is 4141 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Yes but...
I somewhat of a new programmer and I need a specific way to do this...
I would appreciate any help anyone could give me on how exactly to do this...
G
P.S. Thanks for the response

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!