mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Merged context creation BacMatch workaround from 2.7.1.
This commit is contained in:
parent
1792f08dbd
commit
f73f01b68c
@ -292,6 +292,7 @@ version of GLFW.</p>
|
||||
<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 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>
|
||||
</ul>
|
||||
|
||||
|
@ -45,6 +45,17 @@
|
||||
#define Button6 6
|
||||
#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
|
||||
//========================================================================
|
||||
@ -580,12 +591,21 @@ static int createContext(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, G
|
||||
|
||||
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.CreateContextAttribsARB(_glfwLibrary.X11.display,
|
||||
*fbconfig,
|
||||
share,
|
||||
True,
|
||||
attribs);
|
||||
|
||||
// We are done, so unset the error handler again (see above)
|
||||
XSetErrorHandler(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user