aboutsummaryrefslogtreecommitdiffstats
path: root/pugl_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-29 04:12:50 +0000
committerDavid Robillard <d@drobilla.net>2012-04-29 04:12:50 +0000
commite756cdca27d1ce11ae4839ca571e43834a971670 (patch)
tree6331ae841ff2d0df44904d2c40e6b6f925fbb313 /pugl_test.c
parent94b9e452ebd9438a917b825d8d01137ddaa9e398 (diff)
downloadpugl-e756cdca27d1ce11ae4839ca571e43834a971670.tar.gz
pugl-e756cdca27d1ce11ae4839ca571e43834a971670.tar.bz2
pugl-e756cdca27d1ce11ae4839ca571e43834a971670.zip
Implement reshape more properly.
It's not a GL demo if it's not a cube.
Diffstat (limited to 'pugl_test.c')
-rw-r--r--pugl_test.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/pugl_test.c b/pugl_test.c
index c209aef..03afac0 100644
--- a/pugl_test.c
+++ b/pugl_test.c
@@ -43,16 +43,44 @@ onDisplay(PuglWindow* win)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
- glRotatef(xAngle, 1.0f, 0.0f, 0.0f);
+ glTranslatef(0.0f, 0.0f, -10.0f);
glRotatef(xAngle, 0.0f, 1.0f, 0.0f);
+ glRotatef(yAngle, 1.0f, 0.0f, 0.0f);
+
+ /* We tell we want to draw quads */
+ glBegin(GL_QUADS);
+
+ /* Every four calls to glVertex, a quad is drawn */
+ glColor3f(0, 0, 0); glVertex3f(-1, -1, -1);
+ glColor3f(0, 0, 1); glVertex3f(-1, -1, 1);
+ glColor3f(0, 1, 1); glVertex3f(-1, 1, 1);
+ glColor3f(0, 1, 0); glVertex3f(-1, 1, -1);
+
+ glColor3f(1, 0, 0); glVertex3f( 1, -1, -1);
+ glColor3f(1, 0, 1); glVertex3f( 1, -1, 1);
+ glColor3f(1, 1, 1); glVertex3f( 1, 1, 1);
+ glColor3f(1, 1, 0); glVertex3f( 1, 1, -1);
+
+ glColor3f(0, 0, 0); glVertex3f(-1, -1, -1);
+ glColor3f(0, 0, 1); glVertex3f(-1, -1, 1);
+ glColor3f(1, 0, 1); glVertex3f( 1, -1, 1);
+ glColor3f(1, 0, 0); glVertex3f( 1, -1, -1);
+
+ glColor3f(0, 1, 0); glVertex3f(-1, 1, -1);
+ glColor3f(0, 1, 1); glVertex3f(-1, 1, 1);
+ glColor3f(1, 1, 1); glVertex3f( 1, 1, 1);
+ glColor3f(1, 1, 0); glVertex3f( 1, 1, -1);
+
+ glColor3f(0, 0, 0); glVertex3f(-1, -1, -1);
+ glColor3f(0, 1, 0); glVertex3f(-1, 1, -1);
+ glColor3f(1, 1, 0); glVertex3f( 1, 1, -1);
+ glColor3f(1, 0, 0); glVertex3f( 1, -1, -1);
+
+ glColor3f(0, 0, 1); glVertex3f(-1, -1, 1);
+ glColor3f(0, 1, 1); glVertex3f(-1, 1, 1);
+ glColor3f(1, 1, 1); glVertex3f( 1, 1, 1);
+ glColor3f(1, 0, 1); glVertex3f( 1, -1, 1);
- glBegin(GL_TRIANGLES);
- glColor3f(1.0f, 0.0f, 0.0f);
- glVertex3f(0.0f, 1.0f, 0.0f);
- glColor3f(0.0f, 1.0f, 0.0f);
- glVertex3f(-1.0f, -1.0f, 0.0f);
- glColor3f(0.0f, 0.0f, 1.0f);
- glVertex3f(1.0f, -1.0f, 0.0f);
glEnd();
}