Archived

This topic is now archived and is closed to further replies.

Leroy1891

Quick Vertex Array Question

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites