#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 {
void GLContext::platform_init(const GLOptions &opts)
{
- priv = new Private;
-
HDC dc = GetDC(window.get_private().window);
PIXELFORMATDESCRIPTOR pfd;
throw unsupported_gl_mode(opts);
SetPixelFormat(dc, pf_index, &pfd);
+ priv = new Private;
priv->context = wglCreateContext(dc);
wglMakeCurrent(dc, priv->context);
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);
ReleaseDC(window.get_private().window, dc);
}
-void GLContext::window_resized(unsigned w, unsigned h)
-{
- glViewport(0, 0, w, h);
-}
+void GLContext::window_resized(unsigned, unsigned)
+{ }
} // namespace Graphics
} // namespace Msp