Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11opengl.c @ 3105:cdeee9f9b14b
Fixed bug #721
From michalziulek@gmail.com 2009-03-28 07:43:34 (-) [reply]
There is a bug in OpenGL 3.x context creation code.
Function glXGetProcAddress is used directly where it should be:
_this->gl_data->glXGetProcAddress. I have attached patch which fixes this on
x11 and win32. Thanks.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 03 Apr 2009 17:19:05 +0000 |
parents | 7dc982143c06 |
children | 7f684f249ec9 |
comparison
equal
deleted
inserted
replaced
3104:86ea6c073d87 | 3105:cdeee9f9b14b |
---|---|
411 GLX_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, | 411 GLX_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, |
412 0 | 412 0 |
413 }; | 413 }; |
414 | 414 |
415 /* Get a pointer to the context creation function for GL 3.0 */ | 415 /* Get a pointer to the context creation function for GL 3.0 */ |
416 PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((GLubyte*)"glXCreateContextAttribsARB"); | 416 PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = (PFNGLXCREATECONTEXTATTRIBSARBPROC)_this->gl_data->glXGetProcAddress((GLubyte*)"glXCreateContextAttribsARB"); |
417 if (!glXCreateContextAttribs) { | 417 if (!glXCreateContextAttribs) { |
418 SDL_SetError("GL 3.x is not supported"); | 418 SDL_SetError("GL 3.x is not supported"); |
419 context = temp_context; | 419 context = temp_context; |
420 } else { | 420 } else { |
421 /* Create a GL 3.0 context */ | 421 /* Create a GL 3.x context */ |
422 GLXFBConfig *framebuffer_config = NULL; | 422 GLXFBConfig *framebuffer_config = NULL; |
423 int fbcount = 0; | 423 int fbcount = 0; |
424 framebuffer_config = glXChooseFBConfig(display, DefaultScreen(display), NULL, &fbcount); | 424 GLXFBConfig* (*glXChooseFBConfig)(Display* disp, int screen, const int* attrib_list, int* nelements); |
425 if (!framebuffer_config) { | 425 |
426 SDL_SetError("No good framebuffers found. GL 3.0 disabled"); | 426 glXChooseFBConfig = (GLXFBConfig* (*)(Display*, int, const int*, int*))_this->gl_data->glXGetProcAddress((GLubyte*)"glXChooseFBConfig"); |
427 | |
428 if (!glXChooseFBConfig || !(framebuffer_config = glXChooseFBConfig(display, DefaultScreen(display), NULL, &fbcount))) { | |
429 SDL_SetError("No good framebuffers found. GL 3.x disabled"); | |
427 context = temp_context; | 430 context = temp_context; |
428 } else { | 431 } else { |
429 context = glXCreateContextAttribs(display, framebuffer_config[0], NULL, True, attribs); | 432 context = glXCreateContextAttribs(display, framebuffer_config[0], NULL, True, attribs); |
430 glXDestroyContext(display, temp_context); | 433 _this->gl_data->glXDestroyContext(display, temp_context); |
431 } | 434 } |
432 } | 435 } |
433 } | 436 } |
434 } | 437 } |
435 XFree(vinfo); | 438 XFree(vinfo); |