I have a problem with lightning. Lightning works on:
//...
gluSphere(qobj, r1, precision, precision);
//...
But it dosnt work on:
//...
glBegin(GL_TRIANGLES);
glColor3fv(colors[4]);
glVertex3fv(vertices[triangles[fig2][1]]);
glVertex3fv(vertices[triangles[fig2][2]]);
glVertex3fv(vertices[triangles[fig2][3]]);
glEnd();
//...
Here is how it looks:
img http://img72.imageshack.us/img72/2158/36156234.jpg
As you can see only “gluSphere” is lightened. How to make same lightning on GL_TRIANGLES and GL_POLYGON?
A lighting engine needs to know which direction a polygon is facing. Instead of calculating those by itself, OpenGL requires you to provide this information through normals: