Archived

This topic is now archived and is closed to further replies.

Metal Typhoon

What are triangle strips ??

Recommended Posts

In triangle strip mode, GL re-uses the last two vertices you passed with the new vertex you give to create a triangle.

GL_TRIANGLES :
v1 v2 v3 v4 v5 v6 -> (v1 v2 v3) (v4 v5 v6)
GL_TRIANGLE_STRIP :
v1 v2 v3 v4 v5 v6 -> (v1 v2 v3) (v2 v3 v4) (v3 v4 v5) (v4 v5 v6)
GL_TRIANGLE_FAN :
v1 v2 v3 v4 v5 v6 -> (v1 v2 v3) (v1 v2 v4) (v1 v2 v5) (v1 v2 v6)


Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]

Share this post


Link to post
Share on other sites
quote:
Original post by Fruny
...
GL_TRIANGLE_FAN :
v1 v2 v3 v4 v5 v6 -> (v1 v2 v3) (v1 v2 v4) (v1 v2 v5) (v1 v2 v6)
...




Wouldn''t that be
GL_TRIANGLE_FAN :
v1 v2 v3 v4 v5 v6 -> (v1 v2 v3) (v1 v3 v4) (v1 v4 v5) (v1 v5 v6)

I am pretty sure that this one is correct. It doesn''t keep the 2nd vertex to all the other ones it keeps the first vertex.

like this to make a circle

  

glBegin(GL_TRIANGLE_FAN);
glVertex3f(0,0,0);
for (float c=0; c<=PI; c+=PI/20)
glVertex3f(cos(PI),sin(PI),0);
glEnd();



that would make a Circle with 20 polys.

Share this post


Link to post
Share on other sites
quote:
Original post by Xero-X2
Wouldn''t that be
GL_TRIANGLE_FAN :
v1 v2 v3 v4 v5 v6 -> (v1 v2 v3) (v1 v3 v4) (v1 v4 v5) (v1 v5 v6)

I am pretty sure that this one is correct. It doesn''t keep the 2nd vertex to all the other ones it keeps the first vertex.



Yes, you are right, my mistake.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]

Share this post


Link to post
Share on other sites