Skip to main content
GameDev.net gamedev.net
🔒 Locked

Vertex Arrays - Optimized Normal Array

Started by frca Jul 12, 2006 at 4:53 AM 0 replies 600+ views
Original Post
frca
frca
Hello, As far as I know, glDrawElements draws an array of the vertices according to the first parameter. I assume that the normals are to be in the same order as the vertices. And now I would like to know if there is not a solution more optimal, because when there are two faces with common vertex but the normals are different, this vertex had to be twice in the array. Isn't it possible to pass two different arrays of indices, one of normal indices and one of vertex indices? Thank you, typek ________________________________________________ Please correct my posts. I just want to improve my English. Thanks
JonnyQuest
JonnyQuest
The answer is pretty much 'no'. There aren't any extensions I know about that enable this either.

I suspect the overhead would be too great, and it would mess with the card's ability to stream the content, and the whole thing would be counter-productive.

If you're worrying about the amount of data in your vertex buffers, I'd try playing with the data types you use to pass vertex attributes to the card, particularly if you're using shaders. You can usually, for example, use signed/unsigned short ints for normal vectors and texture coordinates and map them to a suitable range in the vertex shader. From what I remember, strides of multiples of 16 bytes, aligned to 16-byte boundaries tend to be optimal for caches on the card.

Don't forget to benchmark these things though, especially on older cards.

~phil
~phil

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.