summaryrefslogtreecommitdiff
path: root/progs/trivial
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-18 12:55:53 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-18 12:56:23 -0600
commit6fbbeed690c7f9aa0a97fdf64c8c57d1d79e7c33 (patch)
treed03f1776dca777295b46a8fe98618e04e769974f /progs/trivial
parent2a460f6185199bad8b2bca4d0bac319377f801fa (diff)
use perspective projection, press r/R to rotate the quad
Diffstat (limited to 'progs/trivial')
-rw-r--r--progs/trivial/quad-tex-2d.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/progs/trivial/quad-tex-2d.c b/progs/trivial/quad-tex-2d.c
index cb0b9202a2..3a6e5237ed 100644
--- a/progs/trivial/quad-tex-2d.c
+++ b/progs/trivial/quad-tex-2d.c
@@ -30,6 +30,7 @@
static GLenum Target = GL_TEXTURE_2D;
static GLenum Filter = GL_NEAREST;
GLenum doubleBuffer;
+static float Rot = 0;
static void Init(void)
{
@@ -81,13 +82,24 @@ static void Reshape(int width, int height)
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#if 0
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
+#else
+ glFrustum(-1, 1, -1, 1, 10, 20);
+#endif
glMatrixMode(GL_MODELVIEW);
+ glTranslatef(0, 0, -15);
}
static void Key(unsigned char key, int x, int y)
{
switch (key) {
+ case 'r':
+ Rot += 10.0;
+ break;
+ case 'R':
+ Rot -= 10.0;
+ break;
case 27:
exit(0);
default:
@@ -100,17 +112,22 @@ static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
+ glPushMatrix();
+ glRotatef(Rot, 0, 1, 0);
+
glBegin(GL_QUADS);
glTexCoord2f(1,0);
- glVertex3f( 0.9, -0.9, -30.0);
+ glVertex3f( 0.9, -0.9, 0.0);
glTexCoord2f(1,1);
- glVertex3f( 0.9, 0.9, -30.0);
+ glVertex3f( 0.9, 0.9, 0.0);
glTexCoord2f(0,1);
- glVertex3f(-0.9, 0.9, -30.0);
+ glVertex3f(-0.9, 0.9, 0.0);
glTexCoord2f(0,0);
- glVertex3f(-0.9, -0.9, -30.0);
+ glVertex3f(-0.9, -0.9, 0.0);
glEnd();
+ glPopMatrix();
+
glFlush();
if (doubleBuffer) {