]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/glx/glcontext.cpp
Add support for swap interval control
[libs/gui.git] / source / graphics / glx / glcontext.cpp
index 26275a4b6b7ee5cf6626b23f00abe6ddee92f4a2..46da6d1a231091f6aed597e17e7f0f6eeb65911a 100644 (file)
@@ -84,6 +84,15 @@ GLContext::~GLContext()
        delete priv;
 }
 
+void GLContext::set_swap_interval(unsigned i)
+{
+       const GLubyte *name = reinterpret_cast<const GLubyte *>("glXSwapIntervalEXT");
+       PFNGLXSWAPINTERVALEXTPROC func = reinterpret_cast<PFNGLXSWAPINTERVALEXTPROC>(glXGetProcAddress(name));
+       if(!func)
+               throw runtime_error("glXSwapIntervalEXT not found");
+       func(display.get_private().display, priv->subwnd, i);
+}
+
 void GLContext::swap_buffers()
 {
        glXSwapBuffers(display.get_private().display, priv->subwnd);
@@ -92,7 +101,6 @@ void GLContext::swap_buffers()
 void GLContext::window_resized(unsigned w, unsigned h)
 {
        XMoveResizeWindow(display.get_private().display, priv->subwnd, 0, 0, w, h);
-       glViewport(0, 0, w, h);
 }
 
 } // namespace Graphics