Jump to content
  • Advertisement


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


OpenGL How to draw a circle or a arc filled with color in OpenGL?

This topic is 6151 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 guess you can use a triangle fan. Try something like this:

glVertex3f(0.0f, 0.0f, 0.0f)

float i;
for (i = 0; i <= 360.0f; i += 360/num_steps)
glVertex3f(cos(DEGTORAD * i) * radius,
sin(DEGTORAD * i) * radius, 0.0f);

Assume that num_steps is sorta the level of detail of the circle. Basically it''s how circular your circle is going to be. In actuality, this really just creates a regular polygon with num_steps sides. If num_steps is around 30 maybe, it will look close to a circle. radius is the radius of the circle, and DEGTORAD is pi/180.

Did your file get a virus or is your coding always this bad?

Share this post

Link to post
Share on other sites

  • 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!