summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@coffee.donpellegrino.com>2009-08-18 00:07:24 (GMT)
committer Don Pellegrino <don@coffee.donpellegrino.com>2009-08-18 00:07:24 (GMT)
commitd7aa70eaad644f2892c60ce85539d5439e0804b2 (patch) (unidiff)
tree9905daaf7d4522e5ef75cc54849c28bfbcaf42d2
parent0764c52f3f9c8d6b59fd8a5d70634f1544c22a6c (diff)
downloadexp005-d7aa70eaad644f2892c60ce85539d5439e0804b2.zip
exp005-d7aa70eaad644f2892c60ce85539d5439e0804b2.tar.gz
exp005-d7aa70eaad644f2892c60ce85539d5439e0804b2.tar.bz2
Removed viewport state variable since this can be easily retrieved
from OpenGL's GL_VIEWPORT at any time.
-rw-r--r--src/controller/actions/zoom.c2
-rw-r--r--src/controller/callbacks/keyboard.c6
-rw-r--r--src/controller/callbacks/reshape.c3
-rw-r--r--src/model/geometry/density_legend_geometry.c5
-rw-r--r--src/model/state/state.h9
5 files changed, 10 insertions, 15 deletions
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)
57 S.zoom.coords[2] = fmin (start_position[1], end_position[1]);57 S.zoom.coords[2] = fmin (start_position[1], end_position[1]);
58 S.zoom.coords[3] = fmax (start_position[1], end_position[1]);58 S.zoom.coords[3] = fmax (start_position[1], end_position[1]);
59 59
60 reshape (S.viewport.w, S.viewport.h);60 reshape (viewport[2], viewport[3]);
61 61
62 glutPostRedisplay ();62 glutPostRedisplay ();
63 63
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)
45 */45 */
46 pan_info_init (&S.pan);46 pan_info_init (&S.pan);
47 S.zoom.active = false;47 S.zoom.active = false;
48 reshape (S.viewport.w, S.viewport.h);48
49 GLint viewport[4];
50 glGetIntegerv (GL_VIEWPORT, viewport);
51 reshape (viewport[2], viewport[3]);
52
49 glutPostRedisplay ();53 glutPostRedisplay ();
50 break;54 break;
5155
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)
41 // Set the viewport equal to the size of the window.41 // Set the viewport equal to the size of the window.
42 glViewport (0, 0, (GLsizei) w, (GLsizei) h);42 glViewport (0, 0, (GLsizei) w, (GLsizei) h);
4343
44 S.viewport.w = w;
45 S.viewport.h = h;
46
47 density_legend_geometry ();44 density_legend_geometry ();
4845
49 return;46 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)
47 * remains a fixed number of pixels tall when the window is resized47 * remains a fixed number of pixels tall when the window is resized
48 * or zoomed.48 * or zoomed.
49 */49 */
50 double legend_height = (*top - *bottom) / S.viewport.h * 10.0;50 GLint viewport[4];
51 glGetIntegerv (GL_VIEWPORT, viewport);
52
53 double legend_height = (*top - *bottom) / viewport[3] * 10.0;
5154
52 a[0] = *left;55 a[0] = *left;
53 a[1] = *top;56 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
78 } ortho;78 } ortho;
7979
80 /*80 /*
81 * Viewport size.
82 */
83 struct
84 {
85 int w;
86 int h;
87 } viewport;
88
89 /*
90 * Buffer objects.81 * Buffer objects.
91 */82 */
92 unsigned int buffers[1];83 unsigned int buffers[1];

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.