Lindley
06-10-2010, 11:01 AM
Let's say I've got a retangular prism and I'd like to generate uniform normals for each face, straight outward.
If I didn't care about normals, then I could use glDrawElements() to render it, using a vertex array of length 8 and an index array of length 24----it's easy to re-use vertices here.
The question is, can I still re-use vertices if I want to define face normals? Since I only know how to define vertex normals, I'd think I would need to specify 3 different copies of the vertex, each with a different normal. But this seems silly; there has to be a better way to handle this (fairly common) situation. It would make no sense to totally negate the benefits of indexed vertices as soon as normals come into play.
Any ideas?
If I didn't care about normals, then I could use glDrawElements() to render it, using a vertex array of length 8 and an index array of length 24----it's easy to re-use vertices here.
The question is, can I still re-use vertices if I want to define face normals? Since I only know how to define vertex normals, I'd think I would need to specify 3 different copies of the vertex, each with a different normal. But this seems silly; there has to be a better way to handle this (fairly common) situation. It would make no sense to totally negate the benefits of indexed vertices as soon as normals come into play.
Any ideas?