/* Material types */
GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0};
GLfloat diffuse[] = {1.0, 0.8, 0.0, 1.0};
-GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
\ No newline at end of file
+GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
+
+/* Beginning width, height */
+int width = 500, height = 500;
\ No newline at end of file
extern GLfloat diffuse[];
extern GLfloat specular[];
-#endif /* GLOBALS_H */
+/* Beginning width, height */
+extern int width, height;
+#endif /* GLOBALS_H */
\ No newline at end of file
*/\r
void windowReshape(int w, int h) {\r
glViewport(0, 0, (GLsizei) w, (GLsizei) h);\r
- printf("I am called!\n");\r
+ width = w;\r
+ height = h;\r
}\r
\r
/**\r
*/\r
void display() {\r
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\r
+ \r
+ // Redraw projection matrix\r
+ glMatrixMode(GL_PROJECTION);\r
+ glLoadIdentity();\r
+\r
+ float aspect = (float)height / (float)width;\r
+ if ( width > height ) aspect = (float)width / (float)height;\r
+\r
+ gluPerspective(\r
+ 90.0,\r
+ aspect,\r
+ 0.1,\r
+ 100\r
+ );\r
+\r
glMatrixMode(GL_MODELVIEW);\r
glLoadIdentity();\r
\r
- //gluLookAt(\r
- // -30.0, -30.0, -30.0, /* eye is at (x,y,z) */\r
- /// 0.0, 0.0, 0.0, /* center is at (x,y,z) */\r
- // 0.0, 1.0, 0.0 /* up is in postivie Y direction */\r
- // );\r
+ gluLookAt(\r
+ 0.0, 0.0, 30.0, /* eye is at (x,y,z) */\r
+ 0.0, 0.0, 0.0, /* center is at (x,y,z) */\r
+ 0.0, 1.0, 0.0 /* up is in postivie Y direction */\r
+ );\r
+\r
+ glRotatef(30.0, 1.0, 0.0, 0.0);\r
\r
/* Reposition the light source. */\r
lightPosition[0] = 12*cos(lightAngle);\r