From d7aa70eaad644f2892c60ce85539d5439e0804b2 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Tue, 18 Aug 2009 00:07:24 +0000 Subject: Removed viewport state variable since this can be easily retrieved from OpenGL's GL_VIEWPORT at any time. --- diff --git a/src/controller/actions/zoom.c b/src/controller/actions/zoom.c index d7f4140..b8e54cc 100644 --- a/src/controller/actions/zoom.c +++ b/src/controller/actions/zoom.c @@ -57,7 +57,7 @@ zoom (int x1, int y1, int x2, int y2) S.zoom.coords[2] = fmin (start_position[1], end_position[1]); S.zoom.coords[3] = fmax (start_position[1], end_position[1]); - reshape (S.viewport.w, S.viewport.h); + reshape (viewport[2], viewport[3]); glutPostRedisplay (); diff --git a/src/controller/callbacks/keyboard.c b/src/controller/callbacks/keyboard.c index cc917e7..9967ad3 100644 --- a/src/controller/callbacks/keyboard.c +++ b/src/controller/callbacks/keyboard.c @@ -45,7 +45,11 @@ keyboard (unsigned char key, int x, int y) */ pan_info_init (&S.pan); S.zoom.active = false; - reshape (S.viewport.w, S.viewport.h); + + GLint viewport[4]; + glGetIntegerv (GL_VIEWPORT, viewport); + reshape (viewport[2], viewport[3]); + glutPostRedisplay (); break; diff --git a/src/controller/callbacks/reshape.c b/src/controller/callbacks/reshape.c index 95e9329..2455ea3 100644 --- a/src/controller/callbacks/reshape.c +++ b/src/controller/callbacks/reshape.c @@ -41,9 +41,6 @@ reshape (int w, int h) // Set the viewport equal to the size of the window. glViewport (0, 0, (GLsizei) w, (GLsizei) h); - S.viewport.w = w; - S.viewport.h = h; - density_legend_geometry (); return; diff --git a/src/model/geometry/density_legend_geometry.c b/src/model/geometry/density_legend_geometry.c index c437517..e5baa08 100644 --- a/src/model/geometry/density_legend_geometry.c +++ b/src/model/geometry/density_legend_geometry.c @@ -47,7 +47,10 @@ density_legend_geometry (void) * remains a fixed number of pixels tall when the window is resized * or zoomed. */ - double legend_height = (*top - *bottom) / S.viewport.h * 10.0; + GLint viewport[4]; + glGetIntegerv (GL_VIEWPORT, viewport); + + double legend_height = (*top - *bottom) / viewport[3] * 10.0; a[0] = *left; a[1] = *top; diff --git a/src/model/state/state.h b/src/model/state/state.h index ac1e035..26141f2 100644 --- a/src/model/state/state.h +++ b/src/model/state/state.h @@ -78,15 +78,6 @@ typedef struct } ortho; /* - * Viewport size. - */ - struct - { - int w; - int h; - } viewport; - - /* * Buffer objects. */ unsigned int buffers[1]; -- cgit v0.8.3.1-22-g547a