diff options
author | José Fonseca <jose.r.fonseca@gmail.com> | 2011-09-19 10:09:53 +0100 |
---|---|---|
committer | José Fonseca <jose.r.fonseca@gmail.com> | 2011-09-19 10:09:53 +0100 |
commit | 757b2b61e1781fbc903413f8703628468fd6c2f9 (patch) | |
tree | 6fe9b352f6b49527432f130960f1f8c9748e693f /glretrace_main.cpp | |
parent | 5ca8f405b1bb08ecfc216899e517481a4f798121 (diff) |
Infer the drawable size from glBlitFramebuffer too
Diffstat (limited to 'glretrace_main.cpp')
-rw-r--r-- | glretrace_main.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/glretrace_main.cpp b/glretrace_main.cpp index 3a90092..cd35889 100644 --- a/glretrace_main.cpp +++ b/glretrace_main.cpp @@ -103,6 +103,37 @@ checkGlError(Trace::Call &call) { std::cerr << "\n"; } +/** + * Grow the current drawble. + * + * We need to infer the drawable size from GL calls because the drawable sizes + * are specified by OS specific calls which we do not trace. + */ +void +updateDrawable(int width, int height) { + if (!drawable) { + return; + } + + if (width <= glretrace::drawable->width && + height <= glretrace::drawable->height) { + return; + } + + // Check for bound framebuffer last, as this may have a performance impact. + GLint draw_framebuffer = 0; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer); + if (draw_framebuffer != 0) { + return; + } + + glretrace::drawable->resize(width, height); + if (!drawable->visible) { + drawable->show(); + } + glScissor(0, 0, width, height); +} + void snapshot(unsigned call_no) { if (!drawable || |