Coding to draw circle in openGL

hai…i’m still new in openGL. if u guys don’t mind,please help me k. thanks…

float r = 10., xm = 0., ym = 0., phi, dphi = .1*M_PI;

glBegin(GL_LINE_LOOP);

for(phi = 0.; phi <= 2*M_PI; phi += dphi)
  glVertex3f(xm+r*sin(phi), ym+r*cos(phi), 0.);

glEnd();

draws a circle in x-y-plane, center at (xm, ym) with radius r. decreasing the parameter dphi results in a smoother line

Originally posted by fidzi:
hai…i’m still new in openGL. if u guys don’t mind,please help me k. thanks…
you can use quadrics, have a look in the red book

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.