WGL_EXT_swap_control

Recommended Posts

I was curious if WGL_EXT_swap_control could solve my vsync problem (i.e. there appears to be none, and it is necessary for what I am doing) However the code I am using:
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;

char* ext = NULL;

ext = strstr((char*)m_pExtensions, "WGL_EXT_swap_control");

if (ext == NULL)
return DIVX_TRUE;
else
{
if(wglSwapIntervalEXT)
{
wglSwapIntervalEXT(1);
}
}

does something really strange. The extension string is found, but then wglGetProcAddress() returns NULL. Anybody have any clue how that can happen?

Share on other sites
MARS_999    1627
Why not use GLEE or GLEW they have this already done for you.

Try this
typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int );PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;void setVSync(int interval=1){  const char *extensions = glGetString( GL_EXTENSIONS );  if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 )    return; // Error: WGL_EXT_swap_control extension not supported on your computer.\n");  else  {    wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" );    if( wglSwapIntervalEXT )      wglSwapIntervalEXT(interval);  }}

Share on other sites
I could look into adding GLEW, but that would be a big change over for one thing that doesn't work, and I don't really have time to do it at them moment.

I don't see how your code is significantly different than what I have. The error check is structured differently, but mine works as is, and my typedef and glGetString() are elsewhere in the code in my version, but they look just like yours.

Share on other sites
MARS_999    1627
Not sure why adding glew or glee would be such a huge deal, all it does it load all the extensions for you vs. you call all the function pointers yourself...

Share on other sites
Because this is for a commercial software project and in order to use it I have to get all sorts of red tape cleared in order to add a new external lib to our build environment.

Share on other sites
bootstrap    100
Quote:
 Original post by LeadBreakfastBecause this is for a commercial software project and in order to use it I have to get all sorts of red tape cleared in order to add a new external lib to our build environment.
I'm not sure this gets around your problem, but GLEE is equivalent to GLEW, and you can simply include the glee.h and glee.c files in your project and presto-chango, all the [available] extensions are available. In other words, unlike GLEW, GLEE does not require you to adopt their lib file (if I remember GLEW correctly, I adopted GLEE).

Share on other sites
Daaark    3553
Quote:
Original post by bootstrap
Quote:
 Original post by LeadBreakfastBecause this is for a commercial software project and in order to use it I have to get all sorts of red tape cleared in order to add a new external lib to our build environment.
I'm not sure this gets around your problem, but GLEE is equivalent to GLEW, and you can simply include the glee.h and glee.c files in your project and presto-chango, all the [available] extensions are available. In other words, unlike GLEW, GLEE does not require you to adopt their lib file (if I remember GLEW correctly, I adopted GLEE).
Yes, but it adds a license to the project. A very bad license because it requires you to add 'this software is made by Ben Woodhouse' into your readme file as part of the license, and it causes confusion, and doesn't even make sense in any context. If every OpenGL user used GLEE, then every OpenGL program would be copyright 2006 Ben Woodhouse. [lol]