Sign in to follow this  
LeadBreakfast

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
	{
		wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress("wglSwapIntervalEXT");
		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 this post


Link to post
Share on other sites
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 this post


Link to post
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 this post


Link to post
Share on other sites
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by LeadBreakfast
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.
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 this post


Link to post
Share on other sites
Quote:
Original post by bootstrap
Quote:
Original post by LeadBreakfast
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.
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]

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