Jump to content
  • Advertisement
Sign in to follow this  
toogreat4u

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by toogreat4u
Any 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!