Skip to main content
gamedev.net
🔒 Locked

Vertex sharing

Started by deepsender 1 reply 750+ views
Original Post
deepsender
deepsender
I've now seen several contradicting answers to the following question. Tell me what the real answer is please. Here is a quote from the OpenGL documentation: "GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLE_STRIP, and GL_QUAD_STRIP share vertices between their component line segments, triangles, and quads. Other primitives do not." What about GL_TRIANGLE_FAN or GL_QUADS? Do these primitives cause any vertex sharing to occur at all?
Stoic
Stoic
Hi -

GL_TRIANGLE_FAN does cause vertex sharing, GL_QUADS does not.

Basically, any time adding a single vertex adds an entire primitive, that is an example of vertex sharing. In a Triangle Strip, each time you add a vertex, it builds a triangle out of that vertex and the two before it, which are shared with the two before them, etc.

A Vertex in a triangle fan shares with the vertex right behind it, and the first vertex in the list.

But for GL_QUADS, you must specify 4 vertices N times in the list to generate N quads.


Hope this helps!
...
Winograd
Winograd
That quote is from OpenGL FAQ and I wouldn't be suprised if there were some errors in there. If in doubt, always refer to the newest OpenGL specification. However, the same "documentation" says:
Quote:
Note, however, that sharing vertices is implementation dependent. The OpenGL Specification dictates vertex array behavior, and as long as an OpenGL implementation conforms to spec, it's free to optimize vertex sharing in vertex arrays.
For example, a particularly inefficient hardware implementation might not include a vertex cache and thus would not share any vertices independent of the primitive type. In practice, every modern gpu I know has a vertex cache and your job is not to trash it.

EDIT: even though an implementation doesn't have a vertex cache, vertex sharing will show in reduced bandwidth per primitive.

Vertex cache optimization by Nvidia
Research paper about the subject by ATI

Topic Locked

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

Sign in to reply to this topic.