Hello
After solving my surface normal problem fairly recently (calculated using an external program lol) I have noticed that they aren’t appearing correctly with lighting.
What I mean by this is that some faces are light, and some are dark where they shouldn’t be.
I’m using vertex arrays and normal arrays to create objects (there is a colour array in there too, but its left over from a previous implementation).
Plus, I’m pretty sure that the OpenGL coding style that I am using is an older much simpler style than most of you use, so please, help me with layman terms xD This is not the entire code either, that would be far too long to post. This is the object code, which I’m pretty sure the problem is occurring. I think that it is my inexperience with the normal array shown below, we were never shown how to format it correctly and searching the internet has not helped at all.
Thankyou
void headPartTwo()
{
// This part of the model is a component of the head.
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
typedef GLfloat point3[3];
typedef GLfloat point1[1];
point3 vertices[12] = {{-0.6,-1.5,-0.8},{0.6,-1.5,-0.8}, // 0,1
{0.6,1.0,-1.2},{-0.6,1.0,-1.2}, // 2,3
{0.8,-1.5,-0.2},{1.0,1.0,-0.6}, // 4,5
{1.0,0.0,1.2},{0.8,1.0,1.2}, // 6,7
{-0.8,0.0,1.2},{-1.0,1.0,1.2}, // 8,9
{-0.8,-1.5,-0.2},{-1.0,1.0,-0.6}}; // 10,11
point1 normals[24] = {0,0,1, 1,0,0, 1,0,0, 1,0,0, 1,0,0, 0,1,0, 0,1,0, 0,0,1};
point3 color[8] = {{0.0,0.0,0.0},{1.0,0.0,0.0},
{1.0,1.0,0.0},{0.0,1.0,0.0},
{0.0,0.0,1.0},{1.0,0.0,1.0},
{1.0,1.0,1.0},{0.0,1.0,1.0}};
GLubyte cubeIndices[32]={0,1,2,3, 1,4,5,2, 4,6,7,5, 8,10,11,9, 10,0,3,11, 10,4,1,0, 8,6,4,10, 6,8,9,7};
glVertexPointer(3,GL_FLOAT,0,vertices);
glColorPointer(3,GL_FLOAT,0,color);
glNormalPointer(GL_FLOAT,0,normals);
glDrawElements(GL_QUADS, 32, GL_UNSIGNED_BYTE, cubeIndices);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}