]> git.cworth.org Git - apitrace/blobdiff - glws_wgl.cpp
Update news.
[apitrace] / glws_wgl.cpp
index 63ce5fea1444748ef2f6c3956d1a732cb3fdef6d..5fddb7932a5ef49cb3c4c7fab080d4270fe00deb 100644 (file)
@@ -23,6 +23,8 @@
  *
  **************************************************************************/
 
+#include <iostream>
+
 #include "glproc.hpp"
 #include "glws.hpp"
 
@@ -162,6 +164,14 @@ public:
 
     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);
+        }
     }
 };
 
@@ -191,7 +201,18 @@ init(void) {
     /*
      * OpenGL library must be loaded by the time we call GDI.
      */
-    __libGlHandle = LoadLibraryA("OPENGL32");
+
+    const char * libgl_filename = getenv("TRACE_LIBGL");
+
+    if (!libgl_filename) {
+        libgl_filename = "OPENGL32";
+    }
+
+    __libGlHandle = LoadLibraryA(libgl_filename);
+    if (!__libGlHandle) {
+        std::cerr << "error: unable to open " << libgl_filename << "\n";
+        exit(1);
+    }
 }
 
 void
@@ -199,7 +220,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;