PDA

View Full Version : How to Draw a Circle without using GLUT



kashif saeed
11-16-2003, 12:29 AM
hello everyone

i am a beginner and want to know how to draw a circle in openGl without using glut.i am making my application in Visual C++ Win32 API. your help will be greatful
thanks
kashif

mikael_aronsson
11-16-2003, 04:38 AM
x = xpos + radius * cos( v);
y = ypos + radius * sin( v);

v = 0 to PI*2 = full circle

Mikael

kashif saeed
11-16-2003, 09:43 PM
thanks for the maths but what i want to knoe the OpenGL API from which i can draw the circle . like we have
glLine, glPoint, gluSphere etc. any thing like that . i have to use glPoint with teh math u mentioned or what other thing .
thanks

mikael_aronsson
11-16-2003, 10:07 PM
No, you can use GL_LINE_STRIP to create the circle, you don't have to use GL_POINTS, the OpenGL api does not have any way to create a circle for you.

Mikael

nexusone
11-17-2003, 05:35 AM
You could use gluDisk, I don't think glut has a circle command anyway.

gluDisk has a outer radius and inner radius settings, just make the inner close to the outer to make a circle.


Originally posted by kashif saeed:
thanks for the maths but what i want to knoe the OpenGL API from which i can draw the circle . like we have
glLine, glPoint, gluSphere etc. any thing like that . i have to use glPoint with teh math u mentioned or what other thing .
thanks

Deiussum
11-17-2003, 05:51 AM
If you want a filled circle, you could also use a GL_TRIANGLE_FAN, where the first point is the center, and the rest of them are on the perimeter, calculated using the function already given.