GLfloat angle = -150; /* in degrees */\r
GLfloat angle2 = 30; /* in degrees */\r
\r
+GLfloat near = -10;\r
+GLfloat far = 10;\r
+\r
+static float zoomFactor = 1.0;\r
+\r
/**\r
* Prints out error message when file cannot be read\r
* @param fileName Name of file that could not be read\r
* @param h New height\r
*/\r
void windowReshape(int w, int h) {\r
- GLdouble near = -10.0;\r
- GLdouble far = 10.0;\r
-\r
+ zoomFactor = zoomFactor - 1;\r
glViewport(0, 0, (GLsizei) w, (GLsizei) h);\r
glMatrixMode(GL_PROJECTION);\r
glLoadIdentity();\r
if (w <= h) \r
- glOrtho(near, far, near*(GLfloat)h/(GLfloat)w,\r
- far*(GLfloat)h/(GLfloat)w, near, far);\r
+ glOrtho(zoomFactor*near, zoomFactor*far, zoomFactor*near*(GLfloat)h/(GLfloat)w,\r
+ zoomFactor*far*(GLfloat)h/(GLfloat)w, near, far);\r
else\r
- glOrtho(near*(GLfloat)w/(GLfloat)h,\r
- far*(GLfloat)w/(GLfloat)h, near, far, near, far);\r
+ glOrtho(zoomFactor*near*(GLfloat)w/(GLfloat)h,\r
+ zoomFactor*far*(GLfloat)w/(GLfloat)h, zoomFactor*near, zoomFactor*far, near, far);\r
glMatrixMode(GL_MODELVIEW); \r
glLoadIdentity();\r
}\r
gluPerspective(\r
60.0, /* field of view in degree */\r
1.0, /* aspect ratio */\r
- -100.0, /* Z near */\r
- 100.0 /* Z far */\r
+ near, /* Z near */\r
+ far /* Z far */\r
); \r
\r
- glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);\r
- glLightfv(GL_LIGHT0, GL_AMBIENT|GL_SPECULAR|GL_DIFFUSE, lightColor);\r
- glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1);\r
- glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05);\r
- glEnable(GL_LIGHT0);\r
+\r
+GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0};\r
+GLfloat ambient0[] = {1.0, 1.0, 1.0, 1.0};\r
+GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0};\r
+GLfloat light0_pos[] ={ 1.0, 2.0, 3,0, 1.0};\r
+\r
+glEnable(GL_LIGHT0);\r
+glLightfv(GL_LIGHT0, GL_POSITION, light0_pos);\r
+glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0);\r
+glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0);\r
+glLightfv(GL_LIGHT0, GL_SPECULAR, specular0);\r
glEnable(GL_LIGHTING);\r
\r
glMatrixMode(GL_MODELVIEW);\r