At the moment im using one normal per vertex for my models, but that equates to having the model look rounded in terms of lighting, which is not ideal since my models are meant to have sharp edges. googling around shows me that its doesnt seem possible to use surface normals in opengl-es 2.0, but the alternative technique is to use multiple vertex normals per vertex to act as if you were using surface normals.
this would mean that the index buffer would need to be different for the normal array and the vertex array because for example, a cube would have 8 vertices, but each vertex would need 3 normals to act like surface normals (one for each connecting face of the cube, could need more if the model is triangulated which opengl-es requires). so the index array for vertices would be 8, and the index array for the normals would be 8x3=24.
does anyone know how to go about doing this?
at the moment my code looks like this
glGenVertexArraysOES(1, &_vertexArray);
glBindVertexArrayOES(_vertexArray);
glGenBuffers(1, &_indexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices*sizeof(GLubyte), indices, GL_STATIC_DRAW);
glGenBuffers(1, &_vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, numVertices*sizeof(GLfloat), vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, 0);
glGenBuffers(1, &_normalBuffer);
glBindBuffer(GL_ARRAY_BUFFER, _normalBuffer);
glBufferData(GL_ARRAY_BUFFER, numNormals*sizeof(GLfloat), normals, GL_STATIC_DRAW);
glEnableVertexAttribArray(GLKVertexAttribNormal);
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 0, 0);