Mesa (master): demos: fix aspect ratio in Reshape()
Brian Paul
brianp at kemper.freedesktop.org
Thu Apr 9 23:08:29 UTC 2009
Module: Mesa
Branch: master
Commit: 08a1e1ebcb612dfa9172f04e4644b34d95ec7dac
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08a1e1ebcb612dfa9172f04e4644b34d95ec7dac
Author: Brian Paul <brianp at vmware.com>
Date: Thu Apr 9 17:04:58 2009 -0600
demos: fix aspect ratio in Reshape()
---
progs/glsl/bump.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c
index b93ab44..0ea1f83 100644
--- a/progs/glsl/bump.c
+++ b/progs/glsl/bump.c
@@ -150,10 +150,11 @@ Redisplay(void)
static void
Reshape(int width, int height)
{
+ float ar = (float) width / (float) height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+ glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -15.0f);
More information about the mesa-commit
mailing list