]> git.cworth.org Git - apitrace/blobdiff - glws_wgl.cpp
Document out to trace applications inside gdb.
[apitrace] / glws_wgl.cpp
index 4b5870ef75c97378967ebeb02f22c6245849b2bd..ca100d9106b753e5c0cfb8d46453222503c57609 100644 (file)
@@ -23,7 +23,7 @@
  *
  **************************************************************************/
 
-#include "glimports.hpp"
+#include "glproc.hpp"
 #include "glws.hpp"
 
 
@@ -172,8 +172,8 @@ public:
     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)
     {}
@@ -188,6 +188,10 @@ public:
 
 void
 init(void) {
+    /*
+     * OpenGL library must be loaded by the time we call GDI.
+     */
+    __libGlHandle = LoadLibraryA("OPENGL32");
 }
 
 void
@@ -195,7 +199,11 @@ cleanup(void) {
 }
 
 Visual *
-createVisual(bool doubleBuffer) {
+createVisual(bool doubleBuffer, Profile profile) {
+    if (profile != PROFILE_COMPAT) {
+        return NULL;
+    }
+
     Visual *visual = new Visual();
 
     visual->doubleBuffer = doubleBuffer;
@@ -216,7 +224,7 @@ createContext(const Visual *visual, Context *shareContext, Profile profile)
         return NULL;
     }
 
-    return new WglContext(visual, dynamic_cast<WglContext *>(shareContext));
+    return new WglContext(visual, profile, static_cast<WglContext *>(shareContext));
 }
 
 bool
@@ -225,8 +233,8 @@ makeCurrent(Drawable *drawable, Context *context)
     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);