Hello,
First, sorry for my English, I’m a French student.
I’m drawing a quarter cylinder and I want it to be correctly lighted.
I simplify the code to make is more readable.
This think works:
glBegin(GL_QUAD_STRIP);
for (i=-90; i<=0; i+=precision)
{
float angle_radians = i * M_PI / (float)180;
float x = rayon * (float)cos(angle_radians);
float z = rayon * (float)sin(angle_radians);
glNormal3f( 1., 0., 1. );
glVertex3f(x,0,z);
glVertex3f(x,hauteur,z);
}
glEnd();
But I want the light rendering being normal to little rectangles drawn. What follows does not work, it’s lighten as a grid:
glBegin(GL_QUAD_STRIP);
for (i=-90; i<=0; i+=precision)
{
float angle_radians = i * M_PI / (float)180;
float x = rayon * (float)cos(angle_radians);
float z = rayon * (float)sin(angle_radians);
//glNormal3f( 1., 0., 1. );
glNormal3f(cos(i),0,sin(i));
glVertex3f(x,0,z);
glVertex3f(x,hauteur,z);
}
glEnd();
By the way, if you know a glut function that draw a part of cylinder, I’m interested!