diff options
Diffstat (limited to 'progs')
-rw-r--r-- | progs/glsl/texaaline.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c index 2481c0f36e0..7a5ac405bba 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(); |