]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/wgl/glcontext.cpp
Add support for swap interval control
[libs/gui.git] / source / graphics / wgl / glcontext.cpp
index 844f7a712c990a1442a7f442c4d50e5034e5b602..3df83f3119a294fa8472729d95e84451957881a6 100644 (file)
@@ -1,8 +1,11 @@
 #include <windows.h>
 #include <GL/gl.h>
+#include <GL/wglext.h>
 #include "glcontext.h"
 #include "window_private.h"
 
+using namespace std;
+
 namespace Msp {
 namespace Graphics {
 
@@ -53,6 +56,14 @@ GLContext::~GLContext()
        delete priv;
 }
 
+void GLContext::set_swap_interval(unsigned i)
+{
+       PFNWGLSWAPINTERVALEXTPROC func = reinterpret_cast<PFNWGLSWAPINTERVALEXTPROC>(wglGetProcAddress("wglSwapIntervalEXT"));
+       if(!func)
+               throw runtime_error("wglSwapIntervalEXT not found");
+       func(i);
+}
+
 void GLContext::swap_buffers()
 {
        HDC dc = GetDC(window.get_private().window);