Jump to content
  • Advertisement
Sign in to follow this  
MadsGustaf

texturing a circle using GL_TRIANGLE_FAN

This topic is 3685 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 not to sure about how to do this apart from the fact that i probaly needs to use the triangle fan to make the circle and then use glTexCoord. this is how i currently draw the circle using triangle fan.
void drawCircle(float radius)
{

   glColor3ub(255,0,255);
   glBegin(GL_TRIANGLE_FAN);
 
   for (int i=0; i <= 360; i++)
   {
      float degInRad = i*DEG2RAD;
      glVertex2f(cos(degInRad)*radius,sin(degInRad)*radius);
   }
 
   glEnd();
}
still not to sure how to make the rectangular image onto the circle using the glTexCoord. Thanks in advice.

Share this post


Link to post
Share on other sites
Advertisement
I would say either make one of those in a 3D modeling program and export that since the program generates the uv coords for you. Or if this would work, simply texture a quad with an image that is transparent around it so it looks like a circle.

Also, it's better to stay away from GL_TRIANGLE_FAN whenever you can. There are a lot of reason but I can't recall them right now, I guess a google would come up with them.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!