opengl - 使用 for 循环绘制球体
问题描述
我想用for循环画一个球体(我想画一个球体而不是圆,请帮忙)
void drawCircle(double x, double y, double r)
{
glColor3f(nodeBGClolor.r, nodeBGClolor.g, nodeBGClolor.b);
int iterations = 500;
glBegin(GL_POLYGON);
for (int i = 0; i < iterations; i++)
{
double currX = r * cos(2 * PI * (i / (iterations * 1.0)));
double currY = r * sin(2 * PI * (i / (iterations * 1.0)));
glVertex2f(x + currX, y + currY);
}
glEnd();
}
解决方案
推荐阅读
- java - 如何为 Java 调用者声明返回类型为“void”的 Kotlin 函数?
- replication - HazelClient 复制地图的专用成员上的 Hazelcast ClassNotFoundError 删除
- azure - 如何在天蓝色增加时代的大小
- excel - 三个小编辑框不再适合同一列
- android - Firebase 存储生成的 URL 不允许访问该文件
- neo4j - 获取特定类型标签的所有节点和关系
- python - Python - 除了 os.system 之外,还有另一种方法可以从 python 脚本运行 python 脚本吗?
- elasticsearch - 如何对弹性搜索进行预过滤以提高性能?
- c# - 'System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)' 的最佳重载方法匹配有一些无效参数
- c# - 在动态占位符 C# 中生成动态控件