Generate Indices array from Vertex array

Hi Everyone,

I am very new in Opengl programming. Can I know how to generate the Indices Array(Index) from a given Vertex Array in Triangle strip?

and also

How Can I convert an 3D Model into form of Triangle strip from any type of primitive (quad,polygon,triangle,…)?

This two questions have been trapping me for 2 days

Thank you :slight_smile:

Can I know how to generate the Indices Array(Index) from a given Vertex Array in Triangle strip?

In general you can not. There is not enough information in a vertex array, it only stores data (position, normal, colour) at the vertices of an object, but no information about which vertices form a face (e.g. a triangle). So unless you have a special case where you have some additional knowledge which vertices form a triangle you can only use a general purpose algorithm for turning a point cloud into a polygonal model, e.g. the marching cubes algorithm. Or are you saying your vertex data is already organized as a single triangle strip?

How Can I convert an 3D Model into form of Triangle strip from any type of primitive (quad,polygon,triangle,…)?

Have you tried a search engine? Just using “triangle stripping algorithm” I get e.g. this, which at least first glance looks like a reasonable description. If you have non-triangles as input primitives, first convert them to triangles.
You should probably also read Tom Forsyth’ vertex cache optimzations - note in particular the “Background” and “Additional Notes” sections.