X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=72ce8d3d99f301dd29c1a6fd9e68837e63eaff7f;hp=e5ba7cee3ec6094473e68ae2e596574a7ffdf489;hb=931b31d79c7a6a33c8eac86fab2e7f20fc668d3d;hpb=601c83d12be4950573be996457f81d43ccfb8c45 diff --git a/scene.c b/scene.c index e5ba7ce..72ce8d3 100644 --- a/scene.c +++ b/scene.c @@ -556,24 +556,21 @@ motion(int x, int y) void idle() { angle = (int)(angle + 10) % 360; - //angle2 = (int)(angle2 + 10) % 360; - printf("Angle 1: %f, Angle 2: %f\n", angle, angle2); - sleep(25); - glutPostRedisplay(); + //angle2 = (int)(angle2 + 10) % 360; + printf("Angle 1: %f, Angle 2: %f\n", angle, angle2); + sleep(1); + glutPostRedisplay(); } -int drawFloorRecurse = 10; +int drawFloorRecurse = 5; void drawSquare(int recurseLevel, float x1, float y1, float x2, float y2) { - printf("%d, %d, %d, %d\n", x1, y2, x2, y2); - if ( drawFloorRecurse != recurseLevel ) { float xm = (x1 + x2) / 2.0; float ym = (y1 + y2) / 2.0; int rnew = recurseLevel + 1; - printf("Recursing to level %d\n", rnew); // Split into four sub-quads drawSquare(rnew, x1, y1, xm, ym); @@ -582,7 +579,6 @@ void drawSquare(int recurseLevel, float x1, float y1, float x2, float y2) { drawSquare(rnew, xm, y1, x2, ym); } else { - printf("Drawing (%.10f, %.10f) -> (%.10f, %.10f)\n", x1, y2, x2, y2); glBegin(GL_QUADS); glVertex3f(x1, 0.0, y1); glVertex3f(x1, 0.0, y2); @@ -597,30 +593,13 @@ void drawSquare(int recurseLevel, float x1, float y1, float x2, float y2) { * Draw a floor. */ void drawFloor() { - 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();*/ - + drawSquare(0, -1000.0, -1000.0, 1000.0, 1000.0); /*if (useTexture) { glDisable(GL_TEXTURE_2D); }*/ - glEnable(GL_LIGHTING); } /*void drawSquare(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {