]> git.notmuchmail.org Git - apitrace/blobdiff - glws_wgl.cpp
Remove status section from README.
[apitrace] / glws_wgl.cpp
index bc4dd27132b97025945ff4edce94b94209ce105d..b20374362a01f3301685b2152b4045b7367d2571 100644 (file)
@@ -61,8 +61,8 @@ public:
     PIXELFORMATDESCRIPTOR pfd;
     int iPixelFormat;
 
-    WglDrawable(const Visual *vis) :
-        Drawable(vis)
+    WglDrawable(const Visual *vis, int width, int height) :
+        Drawable(vis, width, height)
     {
         static bool first = TRUE;
         RECT rect;
@@ -83,7 +83,7 @@ public:
         dwExStyle = 0;
         dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE | WS_OVERLAPPEDWINDOW;
 
-        int x = 0, y = 0, width = 256, height = 256;
+        int x = 0, y = 0;
 
         rect.left = x;
         rect.top = y;
@@ -134,7 +134,7 @@ public:
     }
     
     void
-    resize(unsigned w, unsigned h) {
+    resize(int w, int h) {
         Drawable::resize(w, h);
         RECT rClient, rWindow;
         GetClientRect(hWnd, &rClient);
@@ -154,10 +154,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() {
@@ -181,15 +183,15 @@ public:
     }
     
     Drawable *
-    createDrawable(const Visual *visual)
+    createDrawable(const Visual *visual, int width, int height)
     {
-        return new WglDrawable(visual);
+        return new WglDrawable(visual, width, height);
     }
 
     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 +208,10 @@ public:
                 if (!wglContext->hglrc) {
                     return false;
                 }
+                if (wglContext->shareContext) {
+                    wglShareLists(wglContext->shareContext->hglrc,
+                                  wglContext->hglrc);
+                }
             }
 
             return wglMakeCurrent(wglDrawable->hDC, wglContext->hglrc);