* @param h New height\r
*/\r
void windowReshape(int w, int h) {\r
- GLdouble near = -10.0;\r
- GLdouble far = 10.0;\r
+ GLdouble near = -1000.0;\r
+ GLdouble far = 1000.0;\r
\r
glViewport(0, 0, (GLsizei) w, (GLsizei) h);\r
glMatrixMode(GL_PROJECTION);\r
void idle() {\r
angle = (int)(angle + 10) % 360;\r
//angle2 = (int)(angle2 + 10) % 360;\r
- printf("Angle 1: %d, Angle 2: %d", angle, angle2);\r
- sleep(2);\r
+ printf("Angle 1: %f, Angle 2: %f\n", angle, angle2);\r
+ sleep(25);\r
glutPostRedisplay();\r
}\r
\r
glVertex3fv(floorVertices[3]);\r
glEnd();*/\r
\r
+drawSquare(0, -1000, -1000, 1000, 1000);\r
+\r
/*if (useTexture) {\r
glDisable(GL_TEXTURE_2D);\r
}*/\r
glEnable(GL_LIGHTING);\r
}\r
\r
+int drawFloorRecurse = 10;\r
+/*void drawSquare(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {\r
+ drawSquare(0, x1, y1, x2, y2);\r
+}*/\r
+\r
+void drawSquare(int recurseLevel, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {\r
+\r
+ printf("Recurse level %d\n", recurseLevel);\r
+\r
+ if ( drawFloorRecurse != recurseLevel ) {\r
+ GLfloat xm = (x2 - x1) / 2.0;\r
+ if ( x1 > x2 ) {\r
+ xm = (x1 - x2) / 2.0;\r
+ }\r
+\r
+ drawSquare(recurseLevel + 1, x1, y1, xm, y2);\r
+ drawSquare(recurseLevel + 1, xm, y1, x2, y2);\r
+ } else {\r
+ printf("Drawing (%f, %f) -> (%f, %f)\n", x1, y2, x2, y2);\r
+ glBegin(GL_QUADS);\r
+ glVertex3f(x1, 0.0, y1);\r
+ glVertex3f(x1, 0.0, y2);\r
+ glVertex3f(x2, 0.0, y2);\r
+ glVertex3f(x2, 0.0, y1);\r
+ glEnd();\r
+ }\r
+\r
+}\r
+\r
/**\r
* Display function\r
*/\r
\r
glPushMatrix();\r
\r
- glTranslatef(0.0, 0.0, 0.0);\r
+ //glTranslatef(0.0, 0.0, 0.0);\r
glutWireTeapot(30); // Draw teapot for test\r
glPopMatrix();\r
\r
glLoadIdentity();\r
\r
gluPerspective(\r
- 60.0, /* field of view in degree */\r
- 1.0, /* aspect ratio */ \r
- 0.0, /* Z near */\r
- 900.0 /* Z far */\r
+ 60.0, /* field of view in degree */\r
+ 1.0, /* aspect ratio */\r
+ -1000.0, /* Z near */\r
+ 1000.0 /* Z far */\r
); \r
\r
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);\r