forked from Mirrorlandia_minetest/irrlicht
Fix CreateContextAttribsARB fallback behaviour
fixes minetest/minetest#12518
This commit is contained in:
parent
c4ca31313f
commit
25ae156944
@ -311,6 +311,16 @@ void CGLXManager::destroySurface()
|
|||||||
glXDestroyWindow((Display*)CurrentContext.OpenGLLinux.X11Display, GlxWin);
|
glXDestroyWindow((Display*)CurrentContext.OpenGLLinux.X11Display, GlxWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(GLX_ARB_create_context)
|
||||||
|
static int IrrIgnoreError(Display *display, XErrorEvent *event)
|
||||||
|
{
|
||||||
|
char msg[256];
|
||||||
|
XGetErrorText(display, event->error_code, msg, 256);
|
||||||
|
os::Printer::log("Ignoring an X error", msg, ELL_DEBUG);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool CGLXManager::generateContext()
|
bool CGLXManager::generateContext()
|
||||||
{
|
{
|
||||||
GLXContext context = 0;
|
GLXContext context = 0;
|
||||||
@ -329,13 +339,16 @@ bool CGLXManager::generateContext()
|
|||||||
|
|
||||||
if (glxCreateContextAttribsARB)
|
if (glxCreateContextAttribsARB)
|
||||||
{
|
{
|
||||||
|
os::Printer::log("GLX with GLX_ARB_create_context", ELL_DEBUG);
|
||||||
int contextAttrBuffer[] = {
|
int contextAttrBuffer[] = {
|
||||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||||
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
|
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
|
||||||
// GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
// GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
XErrorHandler old = XSetErrorHandler(IrrIgnoreError);
|
||||||
context = glxCreateContextAttribsARB((Display*)CurrentContext.OpenGLLinux.X11Display, (GLXFBConfig)glxFBConfig, NULL, True, contextAttrBuffer);
|
context = glxCreateContextAttribsARB((Display*)CurrentContext.OpenGLLinux.X11Display, (GLXFBConfig)glxFBConfig, NULL, True, contextAttrBuffer);
|
||||||
|
XSetErrorHandler(old);
|
||||||
// transparently fall back to legacy call
|
// transparently fall back to legacy call
|
||||||
}
|
}
|
||||||
if (!context)
|
if (!context)
|
||||||
|
Loading…
Reference in New Issue
Block a user