Date: Sun, 30 Apr 2006 14:20:05 +1000
authorSam Lantinga <slouken@libsdl.org>
Mon, 01 May 2006 07:15:35 +0000
changeset 1754c67921b517c3
parent 1753 5b3bb08e7dd8
child 1755 91063c450171
Date: Sun, 30 Apr 2006 14:20:05 +1000
From: Rob
Subject: [SDL] SDL pre-release

OpenGL fails on the zipped pre-release source accessible from
http://www.libsdl.org/svn.php.

Appears to be following lines in sdl_wing.c (lines 341-345):

wglext = (const char *)this->glGetString(GL_EXTENSIONS);
if ( !SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
this->gl_data->wglSwapIntervalEXT = NULL;
this->gl_data->wglGetSwapIntervalEXT = NULL;
}

glGetString is a null pointer, as are other gl function pointers, so call
fails. Never looked at sdl source before, so no further than that as yet.
src/video/wincommon/SDL_wingl.c
     1.1 --- a/src/video/wincommon/SDL_wingl.c	Mon May 01 06:41:17 2006 +0000
     1.2 +++ b/src/video/wincommon/SDL_wingl.c	Mon May 01 07:15:35 2006 +0000
     1.3 @@ -177,6 +177,7 @@
     1.4  	int iAttribs[64];
     1.5  	int *iAttr;
     1.6  	float fAttribs[1] = { 0 };
     1.7 +	const GLubyte *(*glGetStringFunc)(GLenum);
     1.8  	const char *wglext;
     1.9  
    1.10  	/* load the gl driver from a default path */
    1.11 @@ -338,8 +339,14 @@
    1.12  	 * somewhat a documented and reliable hack - it was originally
    1.13  	 * as a feature added by mistake, but since so many people rely
    1.14  	 * on it, it will not be removed.  strstr should be safe here.*/
    1.15 -	wglext = (const char *)this->glGetString(GL_EXTENSIONS);
    1.16 -	if ( !SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
    1.17 +	glGetStringFunc = WIN_GL_GetProcAddress(this, "glGetString");
    1.18 +	if ( glGetStringFunc ) {
    1.19 +		wglext = (const char *)this->glGetString(GL_EXTENSIONS);
    1.20 +	} else {
    1.21 +		/* Uh oh, something is seriously wrong here... */
    1.22 +		wglext = NULL;
    1.23 +	}
    1.24 +	if ( !wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
    1.25  		this->gl_data->wglSwapIntervalEXT = NULL;
    1.26  		this->gl_data->wglGetSwapIntervalEXT = NULL;
    1.27  	}