From: José Fonseca Date: Tue, 12 Apr 2011 13:14:27 +0000 (+0100) Subject: Resize windows at glViewport time. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=d0c9175f4e930773d732fd4a0de3d1f87da83012;p=apitrace Resize windows at glViewport time. --- diff --git a/glretrace.hpp b/glretrace.hpp index ac44aff..a579d58 100644 --- a/glretrace.hpp +++ b/glretrace.hpp @@ -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; diff --git a/glretrace.py b/glretrace.py index d14b548..2736a9f 100644 --- a/glretrace.py +++ b/glretrace.py @@ -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": diff --git a/glretrace_main.cpp b/glretrace_main.cpp index a2d2bdd..52619dd 100644 --- a/glretrace_main.cpp +++ b/glretrace_main.cpp @@ -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(); }