]> git.cworth.org Git - apitrace/commitdiff
Resize windows at glViewport time.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 12 Apr 2011 13:14:27 +0000 (14:14 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 12 Apr 2011 13:14:27 +0000 (14:14 +0100)
glretrace.hpp
glretrace.py
glretrace_main.cpp

index ac44aff5023d20a3c73e8b438ed6500956bf2e00..a579d58f3aef828595857d666116da24eaf96329 100644 (file)
@@ -45,7 +45,6 @@ extern glws::Context *context;
 
 extern int window_width;
 extern int window_height;
-extern bool reshape_window;
 
 extern unsigned frame;
 extern long long startTime;
index d14b54847275bf04751cb6a810a1ec0bddd39b3a..2736a9fb52e4d6b375e321d4a6b1ff548dac1b33 100644 (file)
@@ -125,13 +125,19 @@ class GlRetracer(Retracer):
 
     def call_function(self, function):
         if function.name == "glViewport":
+            print '    bool reshape_window = false;'
             print '    if (x + width > glretrace::window_width) {'
             print '        glretrace::window_width = x + width;'
-            print '        glretrace::reshape_window = true;'
+            print '        reshape_window = true;'
             print '    }'
             print '    if (y + height > glretrace::window_height) {'
             print '        glretrace::window_height = y + height;'
-            print '        glretrace::reshape_window = true;'
+            print '        reshape_window = true;'
+            print '    }'
+            print '    if (reshape_window) {'
+            print '        // XXX: does not always work'
+            print '        glretrace::drawable->resize(glretrace::window_width, glretrace::window_height);'
+            print '        reshape_window = false;'
             print '    }'
 
         if function.name == "glEnd":
index a2d2bdd75fdd47808f6577cd28d992dcec22f163..52619dd211c1ed4b7376fb1cee29933a046fa64b 100644 (file)
@@ -43,7 +43,6 @@ glws::Drawable *drawable = NULL;
 glws::Context *context = NULL;
 
 int window_width = 256, window_height = 256;
-bool reshape_window = false;
 
 unsigned frame = 0;
 long long startTime = 0;
@@ -115,7 +114,7 @@ static void snapshot(Image::Image &image) {
 static void frame_complete(void) {
     ++frame;
     
-    if (!reshape_window && (snapshot_prefix || compare_prefix)) {
+    if (snapshot_prefix || compare_prefix) {
         Image::Image *ref = NULL;
         if (compare_prefix) {
             char filename[PATH_MAX];
@@ -145,12 +144,6 @@ static void frame_complete(void) {
         }
     }
     
-    if (reshape_window) {
-        // XXX: doesn't quite work
-        drawable->resize(window_width, window_height);
-        reshape_window = false;
-    }
-
     ws->processEvents();
 }