aptt
10-04-2005, 06:41 AM
...
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] = { 50.0 };
GLfloat l_ambient[] = { 1, 1, 1, 1};
GLfloat light_position[] = { -2, 0, -2.0, 0.0 };
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_AMBIENT, l_ambient);
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 0.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, (float)((window_w))/(window_h) , 0.001, 1000);
...
GLdouble eq[] = { 1, 0, 0, 0};
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef(0, 0, -5);
glRotatef(10, 0, 1, 0);
glClipPlane(GL_CLIP_PLANE0, eq);
glEnable(GL_CLIP_PLANE0);
glutSolidSphere(1, 20, 20);
glFinish();
...The piece of code above show this (http://img204.imageshack.us/my.php?image=out9mi.png) half-sphere.
Why the inside of the sphere is lighted ??
It shouldn't be completely black ???
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] = { 50.0 };
GLfloat l_ambient[] = { 1, 1, 1, 1};
GLfloat light_position[] = { -2, 0, -2.0, 0.0 };
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_AMBIENT, l_ambient);
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 0.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, (float)((window_w))/(window_h) , 0.001, 1000);
...
GLdouble eq[] = { 1, 0, 0, 0};
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef(0, 0, -5);
glRotatef(10, 0, 1, 0);
glClipPlane(GL_CLIP_PLANE0, eq);
glEnable(GL_CLIP_PLANE0);
glutSolidSphere(1, 20, 20);
glFinish();
...The piece of code above show this (http://img204.imageshack.us/my.php?image=out9mi.png) half-sphere.
Why the inside of the sphere is lighted ??
It shouldn't be completely black ???