Quick Vertex Array Question

Started by
5 comments, last by Leroy1891 21 years, 3 months ago
I am using a vertex array to draw a character. i store each vertex in the array only once and use indexes to draw the shapes. This is fine for vertex and tex coord data but how would i use normals with this method since one vertex can have more than one normal depending on the faces it belongs to.
Advertisement
Actually if there is two different normals per vertex, you can''t share a single vertex. Your case seems pretty weird.

The first solution would be to duplicate vertices in the array.

The second solution would be NOT to use normals in the array, but enable GL_AUTO_NORMAL instead. I''m not sure it will give you the wanted results, but it''s worth trying it.
Isn''t GL_AUTO_NORMAL only used with evaluators?
Actually i just realized something. if i''m doing per vertex normals instead of per face normals, each vertex would have the same normal regardless of the faces it belongs to right?
quote:
Isn't GL_AUTO_NORMAL only used with evaluators?

No. You can do it with any filled primitive : GL_TRIANGLES, GL_POLYGON, GL_QUADS (as well as GL_TRIANGLE_STRIP, etc)... but not GL_LINES or GL_POINTS (nor GL_LINE_STRIP etc).

The good point with evaluators is that normals can be smooth whereas with triangles shading looks flat (not *really* flat though). In other words, evaluators can compute a per-vertex (auto-)normal whereas triangles can only compute a per-triangle (auto-)normal.

quote:
Actually i just realized something. if i'm doing per vertex normals instead of per face normals, each vertex would have the same normal regardless of the faces it belongs to right?

Right. That'd be easier to implement and faces will look smooth.

[edited by - vincoof on January 20, 2003 2:28:08 PM]
Hmm, the spec doesn''t say it should work for normal primitives aswell, and my attempts to get it working fails. Are you sure about this? Can you provide a small example that does work?

Would be cool if it did work.
To be honest, it''s been a while I haven''t tested this functionality because it doesn''t give very good results (kind of flat shading). I''ve read the spec again and you''re right that it''s an evaluator feature.

Though, I''m sure that I made it working on SGI workstations. Maybe it was a bug (cool bug nonetheless) or it was an extension of SGI.

I apologize for the wrong information.

This topic is closed to new replies.

Advertisement