Original Post
Hi, I want to render elliptical cylinder with proper lighting. Cylinder is drawn but the light doesn't work properly. I think that the problem with the normals, but I can't find the problem. glShadeModel GL_SMOOTH ' Draw Top Ellipse as a triangle fan glBegin GL_TRIANGLE_FAN glNormal3f 0#, 1#, 0# glVertex3f 0#, fHeight, 0# For I = 0 To l_vslice fAngle = I * (-6.2831853) / l_vslice '360 degree = 6.2831853 radian glVertex3f Cos(fAngle) * hr, fHeight, Sin(fAngle) * vr Next I glEnd ' Draw Bottom Ellipse as a triangle fan glBegin GL_TRIANGLE_FAN glNormal3f 0#, -1#, 0# glVertex3f 0#, 0, 0# For I = 0 To l_vslice fAngle = I * (6.2831853) / l_vslice '360 degree = 6.2831853 radian glVertex3f Cos(fAngle) * hr, 0, Sin(fAngle) * vr Next I glEnd ' Draw a number of sections that will make up the sides as quad strips Dim fCurrMin As Single, fCurrMax As Single Dim ca As Single, sa As Single For I = 0 To l_hslice - 1 fCurrMin = fHeightInc * I fCurrMax = fCurrMin + fHeightInc glBegin GL_QUAD_STRIP For j = 0 To l_vslice fAngle = j * (6.2831853) / l_vslice ca = hr * Cos(fAngle) sa = vr * Sin(fAngle) glNormal3f ca, fHalfHeight, sa glVertex3f ca, fCurrMin, sa glVertex3f ca, fCurrMax, sa Next j glEnd Next I glPopMatrix