   Cg Vertex Program - Simple Lighting
  I was trying to implement a basic lighting model in a vertex program in Cg. I was trying to achieve lighting on a sphere that is rotating on all axes. The light source and eye point are both at (0, 0, -10) in world coordinates. The problem with the shader is that as the object rotates the polygons facing the viewer are not always shaded... almost as if the light itself rotates along with the sphere. Has anyone encountered such a condition and if so been able to produce a proper result. I figure it has something to do with the inverse of the model view matrix. 
  Problem solved!I was trying to calculate the inverse of the model view matrix myself but apparantly the hardware takes care of all this! I passed in the model view matrix as follows:cgGLSetStateMatrixParameter(m_cgInvModelViewProj,   CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_INVERSE); 