glBegin(GL_LINE_LOOP);
for(int i =0;i<num_lines;i++)
{
angle = i*2*3.14159/num_lines;
glVertex2f(cos(angle),sin(angle));
}
glEnd();
OpenGL- Fill in Circle
I was just wondering, how do I fill in a circle with a color?
Here's my code:
It's probably very easy. Thanks.
GL_LINE_LOOP is a loop made up of line segments. You probably don't want line segments, you want a polygon. So try GL_POLYGON. Keep in mind that under normal culling mode, the vertices have to be in counterclockwise order.
[color=#333333][font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif][size=2]If it's a filled circle:
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glPointSize(radius);
glPoint(x, y, z);[/font]
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glPointSize(radius);
glPoint(x, y, z);[/font]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement