Sign in to follow this  

how to create a triangle list from a triangle strip

This topic is 3723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi there, i need to convert a indexed triangle strip to a indexed triangle list. i tried one method but it isnt really working for me. some triangles stretch through the mesh. it looks horrible. heres what i tried: int indexCount = mesh->numIndices; unsigned short *triStrip = mesh->strip; int a, b, c; for( int i=0; i<indexCount-2; i++ ) { if( i%2 == 0 ) { a = triStrip[i+0]; b = triStrip[i+1]; c = triStrip[i+2]; } else { a = triStrip[i+2]; b = triStrip[i+1]; c = triStrip[i+0]; } printf( "%d %d %d\n", a, b, c ); } anyone ?

Share this post


Link to post
Share on other sites
[URL=http://img512.imageshack.us/my.php?image=treeph8.jpg][IMG]http://img512.imageshack.us/img512/7397/treeph8.th.jpg[/IMG][/URL]

this is a tree model.. as you can see there are couple unwanted triangles there..

i used the code above to convert this strip to a list

what i did was take a strip from a mesh and pass thru this code to create a triangle list. this is the code to write the face indices for the .OBJ file format.
i then loaded it into a OBJ viewer and it gave me that screenshot. 3dsmax simply crashes on my created OBJ files.
i have compared my files with others and they are just fine. not sure why it crashes 3dsmax.

i also checked for bad vertex indices but in my sample i have 319 vertices and face indices doesnt go higher than 318.. which means it doesnt look for non-existant vertices.

about the render.. it renders just fine with the tristrips. so i think that converting it to triangle lists, should work the same.

Share this post


Link to post
Share on other sites
i just thought about this and i think i solved it.
obj files face indices counts from 1 and not 0.
that might be the reason editors crash when loading the files and the reason why the faces are screwed up

Share this post


Link to post
Share on other sites

This topic is 3723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this