Advertisement

Drawing Circles in OpenGL

Started by September 30, 2019 12:18 PM
3 comments, last by 8Observer8 5 years, 1 month ago

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.

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 ?

Advertisement
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.

@calioranged, I wrote my code in Eclipse: Circle_GlfwLwjgl3OpenGL31Java.zip

Circle_GlfwLwjgl3OpenGL31Java.png

This topic is closed to new replies.

Advertisement