PDA

View Full Version : Generate Indices array from Vertex array



VirtualMan
10-27-2013, 04:26 PM
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 :)

carsten neumann
10-28-2013, 01:51 AM
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 (http://www.codercorner.com/Strips.htm), 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 (http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html) - note in particular the "Background" and "Additional Notes" sections.