Jump to content
  • Advertisement
Sign in to follow this  
tenmar

OpenGL VSYNC Problems while using OpenGL

This topic is 4513 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 wanted to know how to disable vsync i read that the SwapBuffers(HDC hDC); function enables vsync. how to disable it, i want to do this because my frame rate is always stuck at 60fps, it seems to be always using the 60fps in 1152x864 res or any other res for that matter but my comp runs at 1152x864 @ 75hz Also how, do u set refresh rate when using openGL, its easy to do in directx, but i can't find any way to do it when using openGL? thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
i too ran into that problem, but i dunno howto disable vsync or change refresh rate, its to deal with the device context stuff/pfd i theenk,

look at http://msdn.microsoft.com

Share this post


Link to post
Share on other sites
i looked everywhere even msdn but still no clue, and all the stuff i find when searching the forums deal with vsync in directx

and again,
all solutions are welcome

Share this post


Link to post
Share on other sites
Use something like this to switch on/off VSync in opengl on windows.

//function pointer typdefs
typedef void (APIENTRY *PFNWGLEXTSWAPCONTROLPROC) (int);
typedef int (*PFNWGLEXTGETSWAPINTERVALPROC) (void);

//declare functions
PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL;
PFNWGLEXTGETSWAPINTERVALPROC wglGetSwapIntervalEXT = NULL;

void InitialiseVSync()
{
//grab extensions
char* extensions = (char*)glGetString(GL_EXTENSIONS);

//check for WGL_EXT_swap_control in the string?
if (strstr(extensions,"WGL_EXT_swap_control"))
{
wglSwapIntervalEXT = (PFNWGLEXTSWAPCONTROLPROC)
wglGetProcAddress("wglSwapIntervalEXT");
wglGetSwapIntervalEXT = (PFNWGLEXTGETSWAPINTERVALPROC)
wglGetProcAddress("wglGetSwapIntervalEXT");
}
}

int VSyncEnabled()
{
//if interval is positif, it is not 0 so enabled ;)
return (wglGetSwapIntervalEXT() > 0);
}

void SetVSyncState(int enable)
{
if (enable)
wglSwapIntervalEXT(1); //set interval to 1 -> enable
else
wglSwapIntervalEXT(0); //disable
}

Share this post


Link to post
Share on other sites
hey welford,

tnx, it worked, but is there a way to do this without extensions, i mean, when i run the code on a comp with an intel card which doesn't have this extension it obviously doesn't work.

And also it there a way to select the refresh rate?

also, when i play games like quake3 etc on a comp with an intel card, it has the option to enable/disable vsync, doesn't quake3 work on openGL? then there must be a way to modify vsync without extensions.

tnx again

Share this post


Link to post
Share on other sites
i think this extension is fairly old, and who knows, maybe Quake 3 uses it too i am sure it uses alot of other extensions aswell.

Isn't there sometimes an option on graphics cards somewhere to turn on/off vSync, or to have the application control it?

[Edited by - Welford on April 7, 2006 3:48:32 AM]

Share this post


Link to post
Share on other sites
yeah, there are usually options to allow vsync to be app controlled or not but not in the comp at school, u see, this pc uses an Intel Extreme Graphics Card 64MB dunno its clock speed, it doesn't support even ps 1 or vs 1.0. and it doesn't have this vsync extension either, is there any other possible way to disable vsync, because dx comes with an option to disable vsync

Share this post


Link to post
Share on other sites
Simply put, no. For any card (yes, even the old Intel ones -- I know, I have one here) which do not have the EXT_swap_control extention, Vsync simply cannot be controlled.

Also: just because an option is "available" doesn't necessarily mean it actually works.

Share this post


Link to post
Share on other sites
yeah,

then can u atleast set the refresh rate?

and dont' tell me to use glut, i already know how to set refresh rate using glut (glutgamemode thing)

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!