Poly_Triangulation and TRIANGLE_STRIP

Guys, is there some way to make Poly_Triangulation generate triangles with TRIANGLE_STRIP (not TRIANGLE_LIST) for high performance indexed draw calls?

I mean generated primitives topology like this:

typedef enum VkPrimitiveTopology {
    VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0,
    VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1,
    VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2,
    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3,
    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4,
    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5,
    VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6,
    VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7,
    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8,
    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9,
    VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10,
    VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF
} VkPrimitiveTopology;

I usually get the triangle vertex indices like this:

Poly_Triangle triangle = triangulation->Triangle(i);
bool face_reversed = (m_occtShape.Orientation() == TopAbs_REVERSED);
if (face_reversed)
    triangle.Get(n1, n3, n2);
else
    triangle.Get(n1, n2, n3);

but all these indexes are not suitable for TRIANGLE_STRIP, because the triangles are generated using TRIANGLE_LIST method and as a result I get the expected trash on the screen. So is there some way to make it generate TRIANGLE_STRIP?

gkv311 n's picture

Triangle strips could be built only for specific triangulated surfaces. In general case, one indexed triangulation has to be split into multiple triangle strips, not a single one. You'll have to write algorithm for such splitting on your own, or find some existing tool for that purpose. Legacy OCCT had a tool Graphic3d_Strips (#0024912), but I never seen it in real applications.

Indexed triangulation works just fine on modern hardware and triangle strip would bring only minor benefit in memory consumption in general case - doesn't worth efforts from my point of view, if you don't have very specific scenario.

Caleb Smith's picture

ok bro, thank you, i agree with you and already forgetting about strips. I think, you're right about "minor benefit" of strips. All of this was relevant ~20...30 years ago:) [old memories made me create this thread]