diff options
Diffstat (limited to 'pugl_test.c')
-rw-r--r-- | pugl_test.c | 44 |
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(); } |