0
votes

In my application I'm trying to create a mesh that is shaded by a single directional light. The problem I'm facing is that I can't seem to get the light to take my normals into account at all.

It works fine if I set the normals on a per-triangle-strip basis, but if I try to render a series of triangles with normals set using the glNormalPointer method the entire mesh is rendered using the same color (which is identical to the result I'm getting if I skip calling glNormalPointer all together).

My mesh render method looks like this:

public void render(GL10 gl) { gl.glFrontFace(GL10.GL_CW); gl.glNormalPointer(GL10.GL_FLOAT, 0, normalBuffer); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, indexBuffer.capacity(), GL10.GL_UNSIGNED_BYTE, indexBuffer); }

1

1 Answers

1
votes

You should call

glEnableClientState(GL_NORMAL_ARRAY);