diff options
author | sfan5 <sfan5@live.de> | 2022-02-20 23:18:17 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-02-20 23:18:17 +0100 |
commit | d59bcdbd0706ac5eb90f55e346904315a9eaf3e2 (patch) | |
tree | c0153dccb8f8e29b310ae44032536b0a12cce4cb /source/Irrlicht/CGLXManager.cpp | |
parent | 09b8837ef9f94ab8f8c287081b19fc7e771c35dc (diff) | |
download | irrlicht-d59bcdbd0706ac5eb90f55e346904315a9eaf3e2.tar.xz |
Create OpenGL context using CreateContextAttribsARB
Diffstat (limited to 'source/Irrlicht/CGLXManager.cpp')
-rw-r--r-- | source/Irrlicht/CGLXManager.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/source/Irrlicht/CGLXManager.cpp b/source/Irrlicht/CGLXManager.cpp index 4d5ef48..a0c37ff 100644 --- a/source/Irrlicht/CGLXManager.cpp +++ b/source/Irrlicht/CGLXManager.cpp @@ -319,12 +319,35 @@ bool CGLXManager::generateContext() {
if (GlxWin)
{
- // create glx context
- context = glXCreateNewContext((Display*)CurrentContext.OpenGLLinux.X11Display, (GLXFBConfig)glxFBConfig, GLX_RGBA_TYPE, NULL, True);
+#if defined(GLX_ARB_create_context)
+
+#ifdef _IRR_OPENGL_USE_EXTPOINTER_
+ PFNGLXCREATECONTEXTATTRIBSARBPROC glxCreateContextAttribsARB=(PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB"));
+#else
+ PFNGLXCREATECONTEXTATTRIBSARBPROC glxCreateContextAttribsARB=glXCreateContextAttribsARB;
+#endif
+
+ if (glxCreateContextAttribsARB)
+ {
+ int contextAttrBuffer[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 0,
+ // GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
+ None
+ };
+ context = glxCreateContextAttribsARB((Display*)CurrentContext.OpenGLLinux.X11Display, (GLXFBConfig)glxFBConfig, NULL, True, contextAttrBuffer);
+ // transparently fall back to legacy call
+ }
if (!context)
+#endif
{
- os::Printer::log("Could not create GLX rendering context.", ELL_WARNING);
- return false;
+ // create glx context
+ context = glXCreateNewContext((Display*)CurrentContext.OpenGLLinux.X11Display, (GLXFBConfig)glxFBConfig, GLX_RGBA_TYPE, NULL, True);
+ if (!context)
+ {
+ os::Printer::log("Could not create GLX rendering context.", ELL_WARNING);
+ return false;
+ }
}
}
else
|