# Understanding normals

Hi, I am learning to use OpenGl with QT and have a question about normals:

Lets say I make a cube and set its top face normal to be {0,1,0}, then if I make another cube but further along the Z axis, e.g +3, would the normal need to be adjusted to {0,1,3}, or is {0,1,0} still used because its just pointing in the up direction. So I guess I’m asking is the normal a vector from its current position or the origin. I feel like this is a silly question but I just wan’t to make sure. I’m using glNormal3fv if that makes any difference.

Thanks.

a normal is a vector that is normal to a face/plane/triangle/quad. translating an object does not change its normals, but rotating an object does (or using functions like gluLookAt, which may apply rotations).

tell me If I’ve understood you correctly,
normals aren’t affected by translations, so having an cube at (0,0,0) and (0,0,3) has the exact same normals. But if I wanted to rotate the object then I’d need to adjust the normals?

if you rotate an object by modifying its nodal coordinates, then you have to re-calculate the normals.
if you rotate an object by using glRotate-functions, you do not change the normals, because they are multiplied automatically with the transformation matrix.

Does glRotate move the camera alongside it then, because when I use it the lighting seems to be affected too?

there is no camera in opengl, it is all just translations and rotations which result in a modelview matrix by which vertices (and lights) are transformed. there is a function (gluLookAt) which allows you to enter parameters as if there was a camera, but after all it just calculates a model transformation matrix.

there is a function to set the position and direction of light sources though. and those are transformed with the modelview matrix.