# Using Triangle Fan correctly

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

## Recommended Posts

I am trying to draw a half circle that will be a cartoonish foot. I am trying to use triangle fans to do this just for educational purposes to teach myself how to do things with different structures. Anyhow I am trying to get a triangle with the fixed point of the triangle fan at (323.2, 63.0), I would like the next set of pairs to flow from (262.4, 63.0) to (384.0, 63.0) creating a semi circle that has a maximum height of 74.0. Here is the code for what I am trying to do:
glBegin(GL_TRIANGLE_FAN);
glVertex2f(323.2, 63.0);
float tempx = 262.4, tempy = 63.0;
bool max = false;
while(tempx <= 385)
{
glVertex2f(tempx, tempy);
tempx = tempx + 5;
if(tempy > 74.0)
max = true;
if(tempy < 63.0)
max = false;
if(!max)
tempy = tempy + 5;
else
tempy = tempy - 5;
}
glEnd();


When I run this code i get an object that is jagged and not in the orientation that I would imagine it to be in. Any help on how to solve this problem would be greatly appreciated. Thanks.

##### Share on other sites
Quote:
 Original post by toogreat4uAny help on how to solve this problem would be greatly appreciated.

Although that's probably not what you want to hear, just forget about it. Triangle fans are a complete dead end. Even if it's only for educational purposes, it's wasted time.

Try to concentrate on getting rid of immediate mode instead. That is much more important than some obsolete geometric primitive.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013300
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!