Jump to content
  • Advertisement
Sign in to follow this  
deepsender

Vsync and fps

This topic is 4270 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

I want to turn off the vsync on my card in order to see actual frame rates while developing in Opengl. I've come up with this code.
void setVSync(void)
{
	typedef bool (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
	PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;
	wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("WGL_EXT_swap_control");
	if (wglSwapIntervalEXT) wglSwapIntervalEXT(0);
}

My frame rate stays at 60. Even when I turn vsync off through my hardware, fps=60. What might be going wrong here? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
This line:
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("WGL_EXT_swap_control");
will not work. Your wglSwapIntervalEXT variable will be set to NULL, since the parameter to wglGetProcAddress needs to be a function name. You need:
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");


EDIT: Also make sure you have a valid OpenGL context (i.e., you have created your OpenGL-enabled window) before calling this function.

Share this post


Link to post
Share on other sites
I made the code correction, and still no change in frame rate. My card's vertical sync is set to Application-controlled.

I'm executing the setVSync() during the call to the InitGL() procedure.


To get fps, I execute this code each time I draw a scene.

nframes++;
t = GetTickCount() - start_ticks;
if (t > 1000) {
frames_per_second = nframes;
nframes = 0;
start_ticks = GetTickCount();
}

The frame rate stays at 60 or very close.

If it helps, I'm working on a notebook with an Nvidia GeForce Go 6800 Ultra.

Thanks.

Share this post


Link to post
Share on other sites
If the code above doesn't work, does that mean something is wrong with my graphic card setup?

Shouldn't vsync be handled internally by OpenGL?

Is this subject addressed in any of the NeHe tutorials, or anywhere on their site? I couldn't find it.

Am I posting in the wrong forum?

I'm using the tauren12 method of trying to get an answer here.

Thanks.

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!