I have added normals to my project, I am pretty sure they are added right, but my lighting is weird.
The raised block is 0, 0, 0 and my light position is -1, 0, -1
Here is some code:
Normals:
float[] normalData = new float[]{
/*Front Normal*/
0, 0, 1,
/*Back Normal*/
0, 0, -1,
/*Left Normal*/
-1, 0, 0,
/*Right Normal*/
1, 0, 0,
/*Bottom Normal*/
0, -1, 0,
/*Top Normal*/
0, 1, 0
};
They are in that order to correspond to the order in which I generate my faces.
Lighting:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLight(GL_LIGHT0, GL_AMBIENT, compileBuffer(new float[]{1.5f, 1.5f, 1.5f, 1f}));
glLight(GL_LIGHT0, GL_DIFFUSE, compileBuffer(new float[]{1.5f, 1.5f, 1.5f, 1f}));
glLight(GL_LIGHT0, GL_POSITION, compileBuffer(new float[]{light.x, light.y, light.z, 1}));
Normals Rendering:
glBindBuffer(GL_ARRAY_BUFFER, normal);
glNormalPointer(GL_FLOAT, 0, 0);
Normals Buffering:
glBindBuffer(GL_ARRAY_BUFFER, normal);
glBufferData(GL_ARRAY_BUFFER, normalBuffer, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
I hope that somewhere along this chain of code is my problem.
(This thread way modified, the following 6 questions have nothing to do with my current question).