hi, i’m currently working on my first opengl project and am trying to implement some lighting. Every site I go to tells me I need to calculate normals for my object. Can anyone tell me what normals are and how to calculate them. What would be the normals for the following cube?
glBegin(GL_QUADS);
glVertex3f( 0.2f, 0.2f,-0.2f); // Top Right Of The Quad (Top)
glVertex3f(-0.2f, 0.2f,-0.2f); // Top Left Of The Quad (Top)
glVertex3f(-0.2f, 0.2f, 0.2f); // Bottom Left Of The Quad (Top)
glVertex3f( 0.2f, 0.2f, 0.2f); // Bottom Right Of The Quad (Top)
glVertex3f( 0.2f,-0.2f, 0.2f); // Top Right Of The Quad (Bottom)
glVertex3f(-0.2f,-0.2f, 0.2f); // Top Left Of The Quad (Bottom)
glVertex3f(-0.2f,-0.2f,-0.2f); // Bottom Left Of The Quad (Bottom)
glVertex3f( 0.2f,-0.2f,-0.2f); // Bottom Right Of The Quad (Bottom)
glVertex3f( 0.2f, 0.2f, 0.2f); // Top Right Of The Quad (Front)
glVertex3f(-0.2f, 0.2f, 0.2f); // Top Left Of The Quad (Front)
glVertex3f(-0.2f,-0.2f, 0.2f); // Bottom Left Of The Quad (Front)
glVertex3f( 0.2f,-0.2f, 0.2f); // Bottom Right Of The Quad (Front)
glVertex3f( 0.2f,-0.2f,-0.2f); // Bottom Left Of The Quad (Back)
glVertex3f(-0.2f,-0.2f,-0.2f); // Bottom Right Of The Quad (Back)
glVertex3f(-0.2f, 0.2f,-0.2f); // Top Right Of The Quad (Back)
glVertex3f( 0.2f, 0.2f,-0.2f); // Top Left Of The Quad (Back)
glVertex3f(-0.2f, 0.2f, 0.2f); // Top Right Of The Quad (Left)
glVertex3f(-0.2f, 0.2f,-0.2f); // Top Left Of The Quad (Left)
glVertex3f(-0.2f,-0.2f,-0.2f); // Bottom Left Of The Quad (Left)
glVertex3f(-0.2f,-0.2f, 0.2f); // Bottom Right Of The Quad (Left)
glVertex3f( 0.2f, 0.2f,-0.2f); // Top Right Of The Quad (Right)
glVertex3f( 0.2f, 0.2f, 0.2f); // Top Left Of The Quad (Right)
glVertex3f( 0.2f,-0.2f, 0.2f); // Bottom Left Of The Quad (Right)
glVertex3f( 0.2f,-0.2f,-0.2f); // Bottom Right Of The Quad (Right)
glEnd();
Really would appreciate some sort of guidance abou this.