*
**************************************************************************/
-#include "glimports.hpp"
+#include "glproc.hpp"
#include "glws.hpp"
void swapBuffers(void) {
SwapBuffers(hDC);
+
+ // Drain message queue to prevent window from being considered
+ // non-responsive
+ MSG msg;
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
}
};
HGLRC hglrc;
WglContext *shareContext;
- WglContext(const Visual *vis, WglContext *share) :
- Context(vis),
+ WglContext(const Visual *vis, Profile prof, WglContext *share) :
+ Context(vis, prof),
hglrc(0),
shareContext(share)
{}
void
init(void) {
+ /*
+ * OpenGL library must be loaded by the time we call GDI.
+ */
+ __libGlHandle = LoadLibraryA("OPENGL32");
}
void
}
Visual *
-createVisual(bool doubleBuffer) {
+createVisual(bool doubleBuffer, Profile profile) {
+ if (profile != PROFILE_COMPAT) {
+ return NULL;
+ }
+
Visual *visual = new Visual();
visual->doubleBuffer = doubleBuffer;
}
Context *
-createContext(const Visual *visual, Context *shareContext)
+createContext(const Visual *visual, Context *shareContext, Profile profile)
{
- return new WglContext(visual, dynamic_cast<WglContext *>(shareContext));
+ if (profile != PROFILE_COMPAT) {
+ return NULL;
+ }
+
+ return new WglContext(visual, profile, static_cast<WglContext *>(shareContext));
}
bool
if (!drawable || !context) {
return wglMakeCurrent(NULL, NULL);
} else {
- WglDrawable *wglDrawable = dynamic_cast<WglDrawable *>(drawable);
- WglContext *wglContext = dynamic_cast<WglContext *>(context);
+ WglDrawable *wglDrawable = static_cast<WglDrawable *>(drawable);
+ WglContext *wglContext = static_cast<WglContext *>(context);
if (!wglContext->hglrc) {
wglContext->hglrc = wglCreateContext(wglDrawable->hDC);