]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/glx/glcontext.cpp
Add a core profile flag to OpenGL context options
[libs/gui.git] / source / graphics / glx / glcontext.cpp
index 5f04e3b2fd51e21afbc1c03eac252623df16e1d7..3ee8865d7559e0890df797cb79ef893097f50847 100644 (file)
@@ -114,6 +114,12 @@ void GLContext::platform_init(const GLOptions &opts)
                                ctx_attribs.push_back(GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB);
                        }
 
+                       if(opts.core_profile)
+                       {
+                               ctx_attribs.push_back(GLX_CONTEXT_PROFILE_MASK_ARB);
+                               ctx_attribs.push_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB);
+                       }
+
                        if(opts.gl_version_major)
                        {
                                ctx_attribs.push_back(GLX_CONTEXT_MAJOR_VERSION_ARB);
@@ -211,10 +217,10 @@ GLContext::~GLContext()
 void GLContext::set_swap_interval(unsigned i)
 {
        const GLubyte *name = reinterpret_cast<const GLubyte *>("glXSwapIntervalEXT");
-       PFNGLXSWAPINTERVALEXTPROC func = reinterpret_cast<PFNGLXSWAPINTERVALEXTPROC>(glXGetProcAddress(name));
-       if(!func)
+       PFNGLXSWAPINTERVALEXTPROC glXSwapInterval = reinterpret_cast<PFNGLXSWAPINTERVALEXTPROC>(glXGetProcAddress(name));
+       if(!glXSwapInterval)
                throw runtime_error("glXSwapIntervalEXT not found");
-       func(display.get_private().display, (priv->glxwnd ? priv->glxwnd : priv->subwnd), i);
+       glXSwapInterval(display.get_private().display, (priv->glxwnd ? priv->glxwnd : priv->subwnd), i);
 }
 
 void GLContext::swap_buffers()