mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
Create GL2.1 context on Linux before trying to create GL3.0.
This commit is contained in:
parent
b889e78841
commit
97bcef11d9
1 changed files with 21 additions and 12 deletions
|
@ -375,7 +375,7 @@ namespace bgfx
|
||||||
};
|
};
|
||||||
|
|
||||||
// Find suitable config
|
// Find suitable config
|
||||||
GLXFBConfig bestconfig = NULL;
|
GLXFBConfig bestConfig = NULL;
|
||||||
|
|
||||||
int nconfigs;
|
int nconfigs;
|
||||||
GLXFBConfig* configs = glXChooseFBConfig(display, DefaultScreen(display), glxAttribs, &nconfigs);
|
GLXFBConfig* configs = glXChooseFBConfig(display, DefaultScreen(display), glxAttribs, &nconfigs);
|
||||||
|
@ -401,7 +401,7 @@ namespace bgfx
|
||||||
|
|
||||||
if (validconfig)
|
if (validconfig)
|
||||||
{
|
{
|
||||||
bestconfig = configs[ii];
|
bestConfig = configs[ii];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,21 +435,30 @@ namespace bgfx
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
XFree(visualInfo);
|
XFree(visualInfo);
|
||||||
|
|
||||||
BX_TRACE("create context");
|
BX_TRACE("Create GL 2.1 context.");
|
||||||
|
m_context = glXCreateContext(display, visualInfo, 0, GL_TRUE);
|
||||||
|
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
|
||||||
|
|
||||||
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
||||||
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
|
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
|
||||||
BGFX_FATAL(glXCreateContextAttribsARB, Fatal::UnableToInitialize, "Failed to get glXCreateContextAttribsARB.");
|
if (NULL != glXCreateContextAttribsARB)
|
||||||
|
|
||||||
const int contextArrib[] =
|
|
||||||
{
|
{
|
||||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
BX_TRACE("Create GL 3.0 context.");
|
||||||
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
|
const int contextArrib[] =
|
||||||
None,
|
{
|
||||||
};
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||||
|
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
|
||||||
|
None,
|
||||||
|
};
|
||||||
|
|
||||||
m_context = glXCreateContextAttribsARB(display, bestconfig, 0, True, contextArrib);
|
GLXContext context = glXCreateContextAttribsARB(display, bestConfig, 0, True, contextArrib);
|
||||||
BGFX_FATAL(m_context, Fatal::UnableToInitialize, "Failed to create GLX context.");
|
|
||||||
|
if (NULL != context)
|
||||||
|
{
|
||||||
|
glXDestroyContext(display, m_context);
|
||||||
|
m_context = context;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glXMakeCurrent(display, window, m_context);
|
glXMakeCurrent(display, window, m_context);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue