glNormalPointer

Ok, this probably a simple problem, but I’m having trouble wrapping my head around it.

I understand that if I have a complex model I have my vertex array and my normal array (as well as texture, color etc). Each normal entry corresponds to a vertex. That’s fine, I understand that…

but, now I have a simple box. 6 vertices. However, each vertex has three possible normals (where the normal depends on which side I’m rendering.)

Is this not doable using pointers? Do I need to seperate my box into 6 seperate sides and render them independantly?

A box is about the worst possible case for vertex arrays since you’ve got plenty of shared vertices but no shared normals. The only way to do it is to duplicate your vertices so you end up with 4 vertices and 4 associated normals for each face. Theres no pointer magic you can do to get around this, since GL will just read the data in in continuous blocks.

It would be nice to have separate indices for vertex, normal, texture coords etc. but I don’t think that’d be as hardware friendly for caching. Plus you’d have so many more indices the actual data to move around would greatly increase.

And when you delve deeper into 3D rendering you’ll gradually realise why there is no sensible way to specify the vertex coordinates just once and the normals separately 3 times.

Cas :slight_smile: