Ok guys from what i have gathered this may be a pretty simple question to answer, but i cant do it.
I am trying to understand how exactly per-vertex normals work and then use this to add gourand shading into my scene. i have a cube with each face at the moment having a normal (+1 or -1 in the x,y and z).
From here how exactly do i change it to per-vertex normals and how do i specify them in opengl. At the moment a normal is set at the beginning of each of the four points to make one face of the cube.
can someone help me asap
I think you have all the knowledge and information to
answer your own question! The GL simply does what you
tell it. It does not “have” anything; you do not just
give it vertices and tell it that you want per-vertex
normals, etc. Whatever you put in the pipeline the
GL will use.
In your case, you have a cube with 6 faces, and thus
you have 6 normals. Every time you draw a face, you
give the same normal 4 times (once for each vertex).
If you had 8 normals only (as many as your vertices),
you would associate each normal with each vertex,
and so you would effectively have a way to specify
a “pair” (using one vertex means that the coresponding
normal will be used as well).
When each face is drawn, a new normal should be
used for each vertex that is drawn. In this way,
you will get lighting to work correctly on curved
surfaces, etc. Bottom line, have as many normals as
you think you need to get your shading to work as
you like it. You just need to have a methodology of
how you pick the normal that you use for each vertex
and face combination. I hope this makes sense.