X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=3e0f34f5c2a708ad83b160c018af88a76d414f48;hb=023daaaaab63ad4475c5839c7218407903815958;hp=26d0d421350f558cbfaca65006a19e33f6efe8fb;hpb=be28556c4dcf730dee7a2bdf6538bd7fef5bc313;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 26d0d42..3e0f34f 100644 --- a/scene.c +++ b/scene.c @@ -510,11 +510,26 @@ void display() { glTranslatef( 0.0f, 0.0f, -5.0f); // Move into the Screen 10.0 glutSolidTeapot(1); - gluLookAt(1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f); + 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 @@ -554,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(); }