Hi
While playing around with OpenGL extensions, I stumbled over the
following bug in the Win32 version od SDL:
OpenGL extensions can not be fetched with the regular GetProcAddress()
call, you have to use the wglGetProcAddress() call from the OpenGL
library (opengl32.dll). Not doing so will always result in a null
pointer. To circumvent the static linking to opengl32.lib when using
wglGetProcAddress(), you can dynamically load it with GetProcAddress().
Yeah, I know it sounds ironical =)
So here is a fix-diff to the stable version 1.1.4 of SDL (/me waves to
Sam =P ):
diff 1.1.4/SDL_wingl.c fix/SDL_wingl.c
217c217,218
< this->gl_data->wglMakeCurrent = NULL;—
this->gl_data->wglMakeCurrent = NULL; this->gl_data->wglGetProcAddress = NULL;
251,252c252,255
< this->gl_data->wglMakeCurrent = (BOOL (WINAPI *)(HDC, HGLRC))
< GetProcAddress(handle, “wglMakeCurrent”);
this->gl_data->wglMakeCurrent = (BOOL (WINAPI *)(HDC, HGLRC)) GetProcAddress(handle, "wglMakeCurrent"); this->gl_data->wglGetProcAddress = (void * (WINAPI *)(const char *)) GetProcAddress(handle, "wglGetProcAddress");
270,274c273
< HMODULE handle;
<
< handle = (HMODULE)this->gl_config.dll_handle;
<
< return (void *)GetProcAddress(handle, proc);
return this->gl_data->wglGetProcAddress(proc);
diff 1.1.4/SDL_wingl_c.h fix/SDL_wingl_c.h
47c47,48
<
void * (WINAPI *wglGetProcAddress)(const char *proc);
I hope this helps!
+Beosil