]> git.cworth.org Git - apitrace/blobdiff - glws_wgl.cpp
Handle explicit flushes better.
[apitrace] / glws_wgl.cpp
index b1e274b5f9314f27e2394f1ea362b70f0a4d3cb9..94390da221f3b8b13eed1d74622da2d09cedb06d 100644 (file)
@@ -107,10 +107,11 @@ public:
         hDC = GetDC(hWnd);
    
         memset(&pfd, 0, sizeof pfd);
-        pfd.cColorBits = 3;
+        pfd.cColorBits = 4;
         pfd.cRedBits = 1;
         pfd.cGreenBits = 1;
         pfd.cBlueBits = 1;
+        pfd.cAlphaBits = 1;
         pfd.cDepthBits = 1;
         pfd.cStencilBits = 1;
         pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
@@ -154,10 +155,12 @@ class WglContext : public Context
 {
 public:
     HGLRC hglrc;
-    
-    WglContext(const Visual *vis) :
+    WglContext *shareContext;
+
+    WglContext(const Visual *vis, WglContext *share) :
         Context(vis),
-        hglrc(0)
+        hglrc(0),
+        shareContext(share)
     {}
 
     ~WglContext() {
@@ -187,9 +190,9 @@ public:
     }
 
     Context *
-    createContext(const Visual *visual)
+    createContext(const Visual *visual, Context *shareContext)
     {
-        return new WglContext(visual);
+        return new WglContext(visual, dynamic_cast<WglContext *>(shareContext));
     }
 
     bool
@@ -206,6 +209,10 @@ public:
                 if (!wglContext->hglrc) {
                     return false;
                 }
+                if (wglContext->shareContext) {
+                    wglShareLists(wglContext->shareContext->hglrc,
+                                  wglContext->hglrc);
+                }
             }
 
             return wglMakeCurrent(wglDrawable->hDC, wglContext->hglrc);