From 6c7174b9047d08634cac3b36e641d8342ffacc2f Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Tue, 18 Oct 2011 11:48:46 +0800 Subject: [PATCH] --- scene.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/scene.c b/scene.c index 638683e..7808d37 100644 --- a/scene.c +++ b/scene.c @@ -570,18 +570,9 @@ void display() { // lightPosition[3] = 1.0; //} - glPushMatrix(); - - /* Tell GL new light source position. */ + glPushMatrix(); glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - /* Draw "bottom" of floor in blue. */ - glFrontFace(GL_CW); /* Switch face orientation. */ - glColor4f(0.1, 0.1, 0.7, 1.0); - drawFloor(); - glFrontFace(GL_CCW); - - /* Draw "top" of floor. Use blending to blend in reflection. */ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.7, 0.0, 0.0, 0.3); @@ -589,18 +580,22 @@ void display() { drawFloor(); glDisable(GL_BLEND); + glutSolidTeapot(1); + glPushMatrix(); glDisable(GL_LIGHTING); + glColor3f(1.0, 1.0, 0.0); /* Draw a yellow ball at the light source. */ glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); glutSolidSphere(1.0, 5, 5); - glEnable(GL_LIGHTING); + glEnable(GL_LIGHTING); glPopMatrix(); - drawFloor(); - glutSwapBuffers(); + glPopMatrix(); + + glutSwapBuffers(); } -- 2.20.1