1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-10-08 15:17:25 -04:00

Merged context creation BacMatch workaround from 2.7.1.

This commit is contained in:
Camilla Berglund 2010-10-04 22:18:58 +02:00
parent 1792f08dbd
commit f73f01b68c
2 changed files with 21 additions and 0 deletions

View File

@ -292,6 +292,7 @@ version of GLFW.</p>
<li>Removed <code>GLFWCALL</code> and <code>GLFWAPIENTRY</code> macros for stdcall calling convention</li> <li>Removed <code>GLFWCALL</code> and <code>GLFWAPIENTRY</code> macros for stdcall calling convention</li>
<li>Bugfix: The default OpenGL version in the <code>version</code> test was set to 1.1</li> <li>Bugfix: The default OpenGL version in the <code>version</code> test was set to 1.1</li>
<li>Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation</li> <li>Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation</li>
<li>[X11] Bugfix: Calling <code>glXCreateContextAttribsARB</code> with an unavailable OpenGL version caused the application to terminate with a <code>BadMatch</code> Xlib error</li>
<li>[Win32] Removed explicit support for versions of Windows older than Windows XP</li> <li>[Win32] Removed explicit support for versions of Windows older than Windows XP</li>
</ul> </ul>

View File

@ -45,6 +45,17 @@
#define Button6 6 #define Button6 6
#define Button7 7 #define Button7 7
//========================================================================
// Error handler for BadMatch errors when requesting context with
// unavailable OpenGL versions using the GLX_ARB_create_context extension
//========================================================================
static int errorHandler(Display *display, XErrorEvent* event)
{
return 0;
}
//======================================================================== //========================================================================
// Checks whether the event is a MapNotify for the specified window // Checks whether the event is a MapNotify for the specified window
//======================================================================== //========================================================================
@ -580,12 +591,21 @@ static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, G
setGLXattrib(attribs, index, None, None); setGLXattrib(attribs, index, None, None);
// This is the only place we set an Xlib error handler, and we only do
// it because glXCreateContextAttribsARB generates a BadMatch error if
// the requested OpenGL version is unavailable (instead of a civilized
// response like returning NULL)
XSetErrorHandler(errorHandler);
window->GLX.context = window->GLX.context =
window->GLX.CreateContextAttribsARB(_glfwLibrary.X11.display, window->GLX.CreateContextAttribsARB(_glfwLibrary.X11.display,
*fbconfig, *fbconfig,
share, share,
True, True,
attribs); attribs);
// We are done, so unset the error handler again (see above)
XSetErrorHandler(NULL);
} }
else else
{ {