🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Vertex sharing

Started by
2 comments, last by lc_overlord 17 years, 5 months ago
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?
Advertisement
no, those primitives do not share vertices.
Unless you use indexed arrays, but that's a different topic alltogether.
Thanks lc.

Isn't a Quad just a short Triangle-strip, so why would anyone ever use a Quad if it does no vertex optimization?

When you say indexed arrays, do you mean vertex arrays, because the documentation says that vertex arrays do no vertex sharing at all. Can you explain the use of indexed arrays?
Quads are quads until they hit the hardware renderer, in which they are split up into two triangles and then immediately to fragments(this happens between the vertex shader and the geo shader), so sure they do sort of share vertics, but not at the same level as tristrips.

It's true vertex arrays does not share vertics other than in the primitives just mentioned, however in some cases if you use VBO the driver/hardware starts doing some sweet optimizations and start sharing vertics with each other.

Indexed arrays hmm... i should have said glDrawElements or element array.
glDrawElements is a special way of doing vertex arrays, instead of just a long list of vertics to render in order, glDrawElements has a list on how to combine the vertex arrays, texture arrays and such things, allowing you to reuse vertices.
The same functionality can be found in VBO but in a slightly more supercharged version.

This topic is closed to new replies.

Advertisement