# NvTriStrips

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

## Recommended Posts

Ok, I want to use NvTriStrips to create triangle strips. I can't figure out which way they want the information. Do they want it via and array of indicies to an array? or like an array that is setup to be used a vertex array? Currently my info is setup like this face { vert1 float[3]; vert2 float[3]; vert3 float[3]; normal1 float[3]; ... tvert1 float[3]; ... } where the verts are they specific verticies not just indicies into an array. Can i send in just an array of my verts? or do I have to send in an array of indicies for each face? Im just curiuos on how to use nvtristrips, also is there a maximum size for strips that is recommended for use with modern cards? -THACO

##### Share on other sites
The NvTriStrip library doesn't care about or take as input your position/normal/texcoord/whatever information. Just your vertex _indices_. All operations are performed on the indices.

##### Share on other sites
That is sorta my problem, what indicies am I sending it. I know this should be easy and I'll be kicking myself for not realizing it but. What should I be sending to the functions? I know I am probably not explaining myself correctly here. I feel like an idiot because I should understand this but I am just missing it. I guess I will try to re-iterate my problem to see if I can explain it better.

I pretty much have an array of face structures like I mentioned above. What indicies would I send it then? or in what order? Or is there another way I should organize my data to make it easier?

-THACO

##### Share on other sites
Save every vertex once (no duplicates) and use the mentioned indices to "bind" the vertices. Take for instance a triangulated cube, it would have 8 vertices (8 corners) and 6*2*3 indices (6 sides, 2 triangles each and each triangle has three vertices pointed to in the vertex pool using indices). Then send the "bind-list" which is just an array of ints in groups of three making up triangles.

It's the best way I can explain it...

##### Share on other sites
Here's a code snippet from my code:
	//now to let NvTriStrip loose	SetListsOnly( true );	PrimitiveGroup* Groups;	unsigned short NumGroups;	GenerateStrips( &Indices[0], (unsigned int) Indices.size(), &Groups, &NumGroups );	Indices.resize( Groups->numIndices );	std::copy( Groups->indices, Groups->indices + Groups->numIndices, Indices.begin() );	delete[] Groups;

My indices are in a std::vector<unsigned short> here. I call GenerateStrips with Lists Only enabled (I only want one result primitive group, and I don't want stitched lists). The resulting Indices, I copy back into the vector, and then delete the groups. That's all there is to it.

NvTriStrip's header has another function to reorder vertices, but I have no idea at all how to use that one.

##### Share on other sites
I am working through it now. I am trying to think, cuz I can't in my head see how its works yet. Of what I understand you just send it the list of indicies into your pool of vertices. That sounds easy enough, the one thing I can't understand is more of how that helps. I am going over it on pencil and paper right now to try to convince myself that just knowing which points are shared between triangles you can do it. I understand it is possible / but I don't see it. Not sure if that explains it, I figured in the first place it would need actual data, but thinking about it more and more I see how it can work with just indicies well im starting to see, gota do some tests. Thanks for all the help, ill post back when I finally figure it out.

-THACO

##### Share on other sites
Ok, it seems to be working. The one remaining question is how do I deal with texture coords. Im working with OpenGL and currently my Pool of vertices consists of all the vertices which are different in terms of x, y, z and the normal that is associated with that vertex. I can see that I will send up with arrays that are the same length when I draw a vertex array and normal array, but what about texture Coords?
Say I am just using vertex ararys, not VBO's I need to set glTexCoordPointer, will that be the same regardless of if I am using triangle strips or no strips?

THACO

##### Share on other sites
One normal, one texcoord per texture slot etc per vertex so you use glTexCoordPointer like the rest.

##### Share on other sites
I've been trhough all this, and you have to be very carefull about how many vertices ( spelling??) share the same texture coord, a quake2 model works
like that , one vertex has more than one texture coord , this is very difficult to render using nvidia tri strip utility without duplicating the vertex ( which it doesn't ) , so you will end up with a messed up model.
I call this kind of models 'unaligned' because of the different count od vertex count and texture coord count, there is one more issue i never managed to solve, not the entire model is rendered using strips, sometimes, ( depending on optimizations you choose ), small gaps appear, these surfaces need to be renderd with a separate algorithm because they are saved in a linked list rather than in a tristrip list.
This sounds very odd for me, has anyone tried to solve this ( bye the way i have now my tristripping algo , this is more just than a curiosity )

##### Share on other sites
Quote:
 Original post by ketekI've been trhough all this, and you have to be very carefull about how many vertices ( spelling??) share the same texture coord, a quake2 model workslike that , one vertex has more than one texture coord , this is very difficult to render using nvidia tri strip utility without duplicating the vertex ( which it doesn't ) , so you will end up with a messed up model.I call this kind of models 'unaligned' because of the different count od vertex count and texture coord count, there is one more issue i never managed to solve, not the entire model is rendered using strips, sometimes, ( depending on optimizations you choose ), small gaps appear, these surfaces need to be renderd with a separate algorithm because they are saved in a linked list rather than in a tristrip list.This sounds very odd for me, has anyone tried to solve this ( bye the way i have now my tristripping algo , this is more just than a curiosity )

Yeah the solution is in Quake source code ;-)

I don't know what you mena rendered in a seperate link lists though...

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
12
5. 5

• 14
• 9
• 22
• 9
• 31
• ### Forum Statistics

• Total Topics
632618
• Total Posts
3007485
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!