X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=3e0f34f5c2a708ad83b160c018af88a76d414f48;hb=023daaaaab63ad4475c5839c7218407903815958;hp=327467df2b33e03481744a1bc736481be9207461;hpb=610f7d0fe55f083c89382619a2cb72180dc9973a;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 327467d..3e0f34f 100644 --- a/scene.c +++ b/scene.c @@ -498,21 +498,38 @@ void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); - glTranslatef(0.0f, 0.0f, 0.0f); + glTranslatef( 0.0f, 0.0f, 0.0f); glBegin(GL_QUADS); - glVertex3f(0.0f, 1.0f, -1.0f); - glVertex3f(0.0f, 1.0f, 1.0f); - glVertex3f(0.0f,-1.0f, 1.0f); - glVertex3f(0.0f,-1.0f, -1.0f); + glVertex3f( 0.0f, 1.0f, -1.0f); + glVertex3f( 0.0f, 1.0f, 1.0f); + glVertex3f( 0.0f, -1.0f, 1.0f); + glVertex3f( 0.0f, -1.0f, -1.0f); glEnd(); - glTranslatef(0.0f,0.0f,-5.0f); // Move into the Screen 10.0 + glTranslatef( 0.0f, 0.0f, -5.0f); // Move into the Screen 10.0 glutSolidTeapot(1); + 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(); glutSwapBuffers(); } +/** + * init function, sets OpenGL's starting state + */ +void init() { + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective( 60, 1, 0.1, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + /** * Main function * @param argc Number of arguments @@ -552,10 +569,7 @@ int main(int argc, char **argv) { makeMenu(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective( 60, 1, 0.1, 1000.0); - glMatrixMode(GL_MODELVIEW); + init(); glutMainLoop(); }