OpenGL Triangle Fans

Started by
2 comments, last by xeos 23 years, 6 months ago
How do bloody triangle strips work??? MSDN documentation sucks, and I can''t remember where else I coud find this out: When I create a triangle strip, is the first point the common point? Or have I got it all wrong (as usual)? Thanks for your help Julian XEOS Digital Development
XEOS Digital Development - Supporting the independant and OpenSource game developers!
Advertisement
MS doc ?
About OpenGL ?

Don''t understand.
If you want infos about triangles_strips or fans, simply by the OpenGL Red Book or go to NeHe.gamedev.net and look in the link list (bottom left) to find an online version of it.
(Version 1.1 however AFAIRemember Good)

-* So many things to do, so little time to spend. *-
-* So many things to do, so little time to spend. *-
http://www.xmission.com/%7Enate/tutors.html (last program)

    1--3--5| /| /|2/_4/_6    


glBegin(GL_TRIANGLE_STRIPS);
glVertex3fv(1)
glVertex3fv(2)
glVertex3fv(3)
glVertex3fv(4)
glVertex3fv(5)
glVertex3fv(6)
glEnd();

will draw the above strip

http://members.xoom.com/myBollux
As I remember: A triangle fan is a group of triangles
which share the same vertex. Take a gander at my crude diagram below:


Vertex A
*
I I
I I I
I I I
I I I
I I I
I I I
I I I
*------*------*
Vertex B Vertex C Vertex D

the asterisks represent the vertices. There are two triangles:
Triangle ABC and ACD. They share the same vertex, vertex A.
You can add more tiangles to the fan, by specifying just one
vertex, instead of three. They are more efficient than triangle strips.

Try this:

    glBegin(GL_TRIANGLE_FAN);glVertex3f(0.0,0.0,75.0);for(float angle=0.0;angle<(2.0*GL_PI);angle+=(GL_PI/8.0)){    float x = 50.0*sin(angle);    float y = 50.0*cos(angle);    glVertex2f(x,y);}glEnd();    


Hope that helps.



The tin-foil lining in my baseball cap stops the government reading my thoughts. ok? OK??

This topic is closed to new replies.

Advertisement