Jump to content
  • Advertisement
calioranged

Drawing Circles in OpenGL

Recommended Posts

I want to draw a circle in OpenGL. I have looked for examples of how to do this, but the only ones I can find use deprecated functions such as glBegin()glEnd() and glVertex().

Can somebody provide an example of how this can be done using modern OpenGL?

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

Really ?

There are too many possibilities, as points, lines, line strips, triangles, triangle fans. In principle you fill a vertex array and eventually an index buffer with vertices describing a circle and unleash a draw call on it ...

Points on a circle are:

x = radius*cos(angle); y = radius*sin(angle)

Or vice versa. The more points, the rounder 🙂

Edited by Green_Baron
Grammar and sentence forming

Share this post


Link to post
Share on other sites
2 hours ago, calioranged said:

I want to draw a circle in OpenGL. I have looked for examples of how to do this, but the only ones I can find use deprecated functions such as glBegin()glEnd() and glVertex().

Can somebody provide an example of how this can be done using modern OpenGL?

Since you didn't specify what you want exactly, I'll mention the fairly obvious solution of using a texture with a circle on it 🙂 If neither this nor the answer above give you what you need, maybe you can clarify your question a little.

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.

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!