I’ve been looking around for some Internet tutorial or introduction for this but found nothing.
What exactly is the definition of a tristrip in Panda3D?
Is it just a list of triangles, such that every triangle in the list shares two vertices with the one before? Does it always have to be the last two vertices, or the same two vertices, of each triangle that are shared with the next one?
Can a single tristrip only produce a line of triangles or is it able to wrap round and form a grid? For example say I have 100 vertices arranged in a square, 10 by 10 grid. It seems to me that a mesh representing this grid could be constructed with a list of triangles such that every triangle shared two vertices with the next/previous one. Is it possible to render this grid as a single tristrip?
Tristrip is an abbreviation for triangle strip. Try googling for “triangle strip”; you’ll probably find more using that name. For instance, this page shows a nice picture of a triangle strip.
Tristrips are strips of triangles where the first three vertices determine a triangle, and after that each new vertex determines a new triangle (defined by the new vertex and the two preceding vertices). Because of the way the triangles flip-flop back and forth in a strip, the vertex winding order alternates, so that the first triangle is defined counter-clockwise (the normal way), the second triangle is clockwise, the third triangle is counter-clockwise again, and so on.
You can make your strips as long as you like, but it’s difficult to make them turn corners in a mesh. Usually a mesh is made out of rows of triangle strips. On some hardware (like SGI), there is actually a performance penalty for making your strips too long; it’s better to have a collection of uniform-length strips than one super-long strip. On PC’s, though, the longer the better.
Although you’ll see lots of literature on the web advocating the use of triangle strips as an important optimization, in practice on modern PC hardware they’re not necessarily faster than using individual, indexed triangles (especially if your triangles are adjacent to either other), since modern graphics cards have a short vertex cache and can optimize when the same vertex is used in several nearby triangles. Triangle strips are more important on platforms like the original SGI hardware, and the PS/2, where there is no vertex cache in the same sense.
Heh. Thanks drwr, I’ve been doing that completely wrong then! I was specifying all three vertices of every triangle, so most vertices got added to the tristrip twice, and I was trying to make a whole mesh out of one strip. :oops: