Circles

How would you go about drawing a circle in openGL. I’'m sorry, I know it’s a stupid question, but I’ve only been looking at openGL for a week… Thanks

Hello,

this has been done before, methinks. But, ah well, I am in a chirpy mood today, so … <deep breath>:

glBegin(GL_LINE_LOOP);
for(int t=0; t<CIRCLE_RES; t++) {
  float angle=((float)t/(float)CIRCLE_RES)*2.0*M_PI;
  glVertex2f(cos(angle), sin(angle));
}
glEnd();

which will draw a unit circle with z=0. SO, you’ll want to scale it and translate it, ‘n’ stuff. But i’m sure you know all that.

cheers,
John