我正在使用 GL_LINE_LOOP 在 C 和 openGL 中绘制一个圆!我可以用颜色填充圆圈吗?
如果需要,这是我正在使用的代码:
const int circle_points=100;
const float cx=50+i, cy=50+x, r=50;
const float pi = 3.14159f;
int i = 50;
glColor3f(1, 1, 1);
glBegin(GL_LINE_LOOP);
for(i=0;i<circle_points;i++)
{
const float theta=(2*pi*i)/circle_points;
glVertex2f(cx+r*cos(theta),cy+r*sin(theta));
}
glEnd();
最佳答案
线循环只是一个轮廓。
要填充中间,您需要使用 GL_POLYGON
。
关于c - OpenGL -- GL_LINE_LOOP --,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22058426/