# Drawing a circle with OpenGL

Hi, I hope to find a easy solution for my problem. I want to draw a circle with OpenGL and I havn’t found a method to do this. I have to write a program which shows/explains the “Bresenham Algorhytm” (when you draw a line or a circle it would be drawn this way). I solved this and it works, but is there no chance to draw a circle with a single funktion call?

I hope this question isn’t to simple

With one function call?

Though it’s expensive, you can always use glu or glut to draw a torus. Just use a very small number for the ring thickness, and don’t scale it.

<shrug> Or you could create a routine that draws the points with GL_BEGIN(GL_POINTS) and run through a while loop which increments a counter and puts the counter through an algorithm to generate x, y coords for a circle. But, that depends on how important it is to have only one function.

Glossifah

BTW, just noticed about 6 posts down, the thread about elipses is pertinent. Check it out Spiderman.

[This message has been edited by Glossifah (edited 11-08-2000).]

Some code (not tested) to draw a circle with lines

GLfloat sphereCenterX, sphereCenterY;
GLfloat x, y, radius = 1;

glColor3f(0, 0, 1);

glBegin(GL_LINES);

cos(0.0174f * 0);
glVertex2f(x, y);

for(i = 20; i < 360; i+=20) {