summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-08-26 11:56:19 -0600
committerBrian Paul <brianp@vmware.com>2009-08-26 11:56:56 -0600
commit2bcf787de1884dff34749d308eb245da457ef649 (patch)
treea241fc10625b8c159a7b9e0193c143bde9a87b59
parent7ffbe487069575d5b5077cb631a1fc9494920fbd (diff)
progs/glsl: handle window resizes in texaaline.c
-rw-r--r--progs/glsl/texaaline.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c
index 2481c0f36e..7a5ac405bb 100644
--- a/progs/glsl/texaaline.c
+++ b/progs/glsl/texaaline.c
@@ -103,6 +103,8 @@ static float Sin(float a)
static void
Redisplay(void)
{
+ float cx = 0.5 * WinWidth, cy = 0.5 * WinHeight;
+ float len = 0.5 * WinWidth - 20.0;
int i;
glClear(GL_COLOR_BUFFER_BIT);
@@ -114,20 +116,20 @@ Redisplay(void)
for (i = 0; i < 360; i+=5) {
float v0[2], v1[2];
- v0[0] = 150 + 40 * Cos(i);
- v0[1] = 150 + 40 * Sin(i);
- v1[0] = 150 + 130 * Cos(i);
- v1[1] = 150 + 130 * Sin(i);
+ v0[0] = cx + 40 * Cos(i);
+ v0[1] = cy + 40 * Sin(i);
+ v1[0] = cx + len * Cos(i);
+ v1[1] = cy + len * Sin(i);
QuadLine(v0, v1, Width);
}
{
float v0[2], v1[2], x;
for (x = 0; x < 1.0; x += 0.2) {
- v0[0] = 150 + x;
- v0[1] = 150 + x * 40 - 20;
- v1[0] = 150 + x + 5.0;
- v1[1] = 150 + x * 40 - 20;
+ v0[0] = cx + x;
+ v0[1] = cy + x * 40 - 20;
+ v1[0] = cx + x + 5.0;
+ v1[1] = cy + x * 40 - 20;
QuadLine(v0, v1, Width);
}
}
@@ -142,6 +144,8 @@ Redisplay(void)
static void
Reshape(int width, int height)
{
+ WinWidth = width;
+ WinHeight = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();