PDA

View Full Version : GL_TRIANGLE or GL_TRIANGLE_STRIP?



Questions Burner
12-11-2001, 09:35 PM
When loading model, is the model rendered with triangles using GL_TRIANGLES or GL_TRIANGLE_STRIP or something else?

Spiral Man
12-11-2001, 10:09 PM
umm, that depends on whether you call glBegin(GL_TRIANGLES) or glBegin(GL_TRIANGLE_STRIP http://www.opengl.org/discussion_boards/ubb/wink.gif ). what do you mean by "loading model"? are you using some higher level library, or are you asking what you should use? there is no glLoadModel function call...

if you are asking what you should use, triangle strips are better, because a) there are fewer function calls, b) they can use vertex sharing (probably implementation dependent) and c) probably some other things that i cant think of at the moment...

Questions Burner
12-12-2001, 08:18 PM
I mean when loading model from 3DS, ASE... and when creating own 3D model.
Which is better or more common?

Spiral Man
12-12-2001, 09:48 PM
well, like i said, triangle strips are better, but triangles are easier (but i dont know if they are more common). some 3d files may store things as triangle strips, but i dont know which ones, if any do that.

if the file format doesnt store things as triangles strips (most likely), you will have to calculate which triangles go into strips. there are several algorithms to do this, as well as some libraries that are already written..

rixed
12-13-2001, 12:23 AM
from what I remember, 3ds, dxf and vrml stores vertex in any order, then polygons ("maillage" in french). So, this is Triangle for openGL.

Questions Burner
12-13-2001, 05:26 AM
Originally posted by Spiral Man:
well, like i said, triangle strips are better, but triangles are easier (but i dont know if they are more common). some 3d files may store things as triangle strips, but i dont know which ones, if any do that.

if the file format doesnt store things as triangles strips (most likely), you will have to calculate which triangles go into strips. there are several algorithms to do this, as well as some libraries that are already written..

What! Need to calculate, then using GL_TRIANGLES is lot easier. But what you mean by GL_TRIANGLE_STRIP is better?

Spiral Man
12-13-2001, 09:40 AM
when you actually end up drawing the triangles, they draw faster, and you get better frame rates, if you use triangle strips. the optimal thing to do would be to load the triangles in from the file, calculate the triangle strips from those, and then use the triangle strips when you draw the object (you should probably also get rid of the original triangles as well, so they dont waste memory...)

yes, it is a pain, but if you have models with high polygon counts, and you use a good striping algorithm (creates longer strips, that contain more triangles) then you can signifigantly increase the rendering speed.

Questions Burner
12-13-2001, 08:31 PM
Thanks.