X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=a9a5d6b221e63d2e039ef16f53b3ac22706fc3bd;hb=a56d2d3830d709d792cdb5a54386988bca4206e0;hp=3d5583f9c6666e6c70552ea0e7c5ab83c378968f;hpb=55b5f8f1554ca1368031583fb99be833d84a358c;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 3d5583f..a9a5d6b 100644 --- a/scene.c +++ b/scene.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "bitmap.h" @@ -483,8 +484,8 @@ void makeMenu() { * @param h New height */ void windowReshape(int w, int h) { - GLdouble near = -10.0; - GLdouble far = 10.0; + GLdouble near = -1000.0; + GLdouble far = 1000.0; glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); @@ -508,7 +509,7 @@ void windowReshape(int w, int h) { */ /*void mouse(int btn, int state, int x, int y) { -}*/ +}*//* static void mouse(int button, int state, int x, int y) { @@ -551,8 +552,15 @@ motion(int x, int y) lightStartY = y; glutPostRedisplay(); } -} +}*/ +void idle() { + angle = (int)(angle + 10) % 360; + //angle2 = (int)(angle2 + 10) % 360; + printf("Angle 1: %f, Angle 2: %f\n", angle, angle2); + sleep(2); + glutPostRedisplay(); +} /** * Draw a floor. @@ -564,7 +572,7 @@ void drawFloor() { // glEnable(GL_TEXTURE_2D); //} - /*glBegin(GL_QUADS); + glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex3fv(floorVertices[0]); glTexCoord2f(0.0, 16.0); @@ -573,7 +581,7 @@ void drawFloor() { glVertex3fv(floorVertices[2]); glTexCoord2f(16.0, 0.0); glVertex3fv(floorVertices[3]); - glEnd();*/ + glEnd(); /*if (useTexture) { glDisable(GL_TEXTURE_2D); @@ -615,7 +623,6 @@ void display() { glPushMatrix(); //glTranslatef(0.0, 0.0, 0.0); - glutWireTeapot(30); // Draw teapot for test glPopMatrix(); @@ -643,10 +650,10 @@ void init() { glLoadIdentity(); gluPerspective( - 60.0, /* field of view in degree */ - 1.0, /* aspect ratio */ - 0.0, /* Z near */ - 900.0 /* Z far */ + 60.0, /* field of view in degree */ + 1.0, /* aspect ratio */ + -1000.0, /* Z near */ + 1000.0 /* Z far */ ); glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); @@ -692,14 +699,15 @@ int main(int argc, char **argv) { glDepthFunc(GL_LEQUAL); // the type glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); - glLineWidth(3.0); + glLineWidth(1.0); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glutReshapeFunc(windowReshape); glutDisplayFunc(display); - glutMouseFunc(mouse); - glutMotionFunc(motion); + //glutMouseFunc(mouse); + //glutMotionFunc(motion); + glutIdleFunc(idle); makeMenu();