From: Ash Tyndall Date: Tue, 18 Oct 2011 03:28:35 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=commitdiff_plain;h=36e1679e77db07de3b54b6054b118607112c360e --- diff --git a/scene.c b/scene.c index 3e0f34f..e2d17e6 100644 --- a/scene.c +++ b/scene.c @@ -491,6 +491,42 @@ void mouse(int btn, int state, int x, int y) { } +static GLfloat floorVertices[4][3] = { + { -20.0, 0.0, 20.0 }, + { 20.0, 0.0, 20.0 }, + { 20.0, 0.0, -20.0 }, + { -20.0, 0.0, -20.0 }, +}; + +/* Draw a floor (possibly textured). */ +static void +drawFloor(void) +{ + glDisable(GL_LIGHTING); + + //if (useTexture) { + // glEnable(GL_TEXTURE_2D); + //} + + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); + glVertex3fv(floorVertices[0]); + glTexCoord2f(0.0, 16.0); + glVertex3fv(floorVertices[1]); + glTexCoord2f(16.0, 16.0); + glVertex3fv(floorVertices[2]); + glTexCoord2f(16.0, 0.0); + glVertex3fv(floorVertices[3]); + glEnd(); + + /*if (useTexture) { + glDisable(GL_TEXTURE_2D); + }*/ + + glEnable(GL_LIGHTING); +} + + /** * Display function */ @@ -510,13 +546,14 @@ void display() { glTranslatef( 0.0f, 0.0f, -5.0f); // Move into the Screen 10.0 glutSolidTeapot(1); - glMatrixMode(GL_MODELVIEW); + /*glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.7f, 0.4f, 0.9f, -2.0f, -1.0f, -7.0f, 1.0f, 10.0f, 1.0f); glMatrixMode(GL_PROJECTION); - glLoadIdentity(); + glLoadIdentity();*/ + drawFloor(); glutSwapBuffers(); }