小编use*_*016的帖子

OpenGL - GL_LINE_LOOP -

我正在使用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();
Run Code Online (Sandbox Code Playgroud)

c opengl geometry colors

3
推荐指数
2
解决办法
2万
查看次数

标签 统计

c ×1

colors ×1

geometry ×1

opengl ×1