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. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403575
This commit is contained in:
parent
ce21b3731c
commit
d7b72e290b
2 changed files with 11 additions and 8 deletions
|
@ -512,7 +512,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB");
|
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) _this->gl_data->wglGetProcAddress("wglCreateContextAttribsARB");
|
||||||
if (!wglCreateContextAttribsARB) {
|
if (!wglCreateContextAttribsARB) {
|
||||||
SDL_SetError("GL 3.x is not supported");
|
SDL_SetError("GL 3.x is not supported");
|
||||||
context = temp_context;
|
context = temp_context;
|
||||||
|
@ -525,7 +525,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
/* Create the GL 3.x context */
|
/* Create the GL 3.x context */
|
||||||
context = wglCreateContextAttribsARB(hdc, 0, attribs);
|
context = wglCreateContextAttribsARB(hdc, 0, attribs);
|
||||||
/* Delete the GL 2.x context */
|
/* Delete the GL 2.x context */
|
||||||
wglDeleteContext(temp_context);
|
_this->gl_data->wglDeleteContext(temp_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -413,21 +413,24 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get a pointer to the context creation function for GL 3.0 */
|
/* Get a pointer to the context creation function for GL 3.0 */
|
||||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((GLubyte*)"glXCreateContextAttribsARB");
|
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = (PFNGLXCREATECONTEXTATTRIBSARBPROC)_this->gl_data->glXGetProcAddress((GLubyte*)"glXCreateContextAttribsARB");
|
||||||
if (!glXCreateContextAttribs) {
|
if (!glXCreateContextAttribs) {
|
||||||
SDL_SetError("GL 3.x is not supported");
|
SDL_SetError("GL 3.x is not supported");
|
||||||
context = temp_context;
|
context = temp_context;
|
||||||
} else {
|
} else {
|
||||||
/* Create a GL 3.0 context */
|
/* Create a GL 3.x context */
|
||||||
GLXFBConfig *framebuffer_config = NULL;
|
GLXFBConfig *framebuffer_config = NULL;
|
||||||
int fbcount = 0;
|
int fbcount = 0;
|
||||||
framebuffer_config = glXChooseFBConfig(display, DefaultScreen(display), NULL, &fbcount);
|
GLXFBConfig* (*glXChooseFBConfig)(Display* disp, int screen, const int* attrib_list, int* nelements);
|
||||||
if (!framebuffer_config) {
|
|
||||||
SDL_SetError("No good framebuffers found. GL 3.0 disabled");
|
glXChooseFBConfig = (GLXFBConfig* (*)(Display*, int, const int*, int*))_this->gl_data->glXGetProcAddress((GLubyte*)"glXChooseFBConfig");
|
||||||
|
|
||||||
|
if (!glXChooseFBConfig || !(framebuffer_config = glXChooseFBConfig(display, DefaultScreen(display), NULL, &fbcount))) {
|
||||||
|
SDL_SetError("No good framebuffers found. GL 3.x disabled");
|
||||||
context = temp_context;
|
context = temp_context;
|
||||||
} else {
|
} else {
|
||||||
context = glXCreateContextAttribs(display, framebuffer_config[0], NULL, True, attribs);
|
context = glXCreateContextAttribs(display, framebuffer_config[0], NULL, True, attribs);
|
||||||
glXDestroyContext(display, temp_context);
|
_this->gl_data->glXDestroyContext(display, temp_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue