Public Group

Opengl Draw Circle

This topic is 3897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi, I've been trying to draw a circle at specific coordinates (x,y) with a radius of 5, so I have this code:
    glBegin(GL_LINE_LOOP);
glColor3f(0.0,1.0,0.0);
for (int i=0; i < 360; i++)
{
}
glEnd();


But it doesn't work at all, and I'm not sure why, also, DEG2RAD is just const float DEG2RAD = 3.14159/180; EIDT: I got it to show, but it only shows 1/4 of it in the bottom left corner, at the point (0,0) Thanks, I'd appreciate the help.

Share on other sites
Sorry, I figured out how to fix it, nevermind. :O

Share on other sites
How did you fix it? It's always frustrating when you come to someone's post through google and they say they fixed it, but never say how!

I probably wouldn't be rendering 360 segments of a line loop. As few as 20 will look smooth and be a lot more efficient. There may be a glu function to do this (I know there is one for spheres), but if not you can look at the sphere function for inspiration.

Share on other sites
Quote:
 Original post by jonahrowleyHow did you fix it?

The circle is positioned at the origin in the XY-plane, I suspect the OP simply was not 'looking' at the circle.

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 9
• 13
• 19
• 14
• 9
• Forum Statistics

• Total Topics
632940
• Total Posts
3009328
• Who's Online (See full list)

There are no registered users currently online

×