Index Buffer generation

Started by Tomm9080, August 02, 2018, 12:16:25

Previous topic - Next topic

Tomm9080

Hi,

is there any possibility of generating a index-Buffer by calculating the exact order of values maybe  in an Array Maybe floats by a tool or sth like that,
or do i have to write it on my own in a method?

KaiHH

Sure, given an ordered sequence of vertices having one of the available topologies/primitive types (such as GL_TRIANGLES) you can easily compute an index buffer which reuses duplicate/equal vertices.

For example, given the list (2D vertices for simplicity): [(0, 0), (1, 0), (1, 1), (1, 1), (0, 1), (0, 0)]
You can compute a new vertices list: [(0, 0), (1, 0), (1, 1), (0, 1)]
and a corresponding index buffer: [0, 1, 2, 2, 3, 0]

If that's what you're after.