如何在 OpenGL 中创建一个带三角形的均匀球体? [英] How to create an even sphere with triangles in OpenGL?

查看:16
本文介绍了如何在 OpenGL 中创建一个带三角形的均匀球体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个公式可以生成一组顶点位于球体上的三角形坐标?

Is there a formula that generates a set of coordinates of triangles whose vertices are located on a sphere?

我可能正在寻找与 gluSphere 类似的东西.然而,我需要以特定颜色为不同的三角形着色,这样看来我不能使用 gluSphere.

I am probably looking for something that does something similar to gluSphere. Yet, I need to color the different triangles in specfic colors so that it seems I can't use gluSphere.

另外:我确实理解 gluSphere 沿着具有相同经度和纬度的线绘制边缘,这使得三角形在极点处比在赤道处的大小要小.现在,如果这样的公式可以生成三角形,使得它们的大小差异最小,那就太好了.

Also: I do understand that gluSphere draws edges along lines with equal longitudes and lattitudes which entails the triangles being small at the poles compared to their size at the equator. Now, if such a formula would generate the triangles such that their difference in size is minimized, that would be great.

推荐答案

从一个单元二十面体开始.然后应用多个三角形的同质细分,归一化得到的顶点到原点的距离.

Start with a unit icosahedron. Then apply muliple homogenous subdivisions of the triangles, normalizing the resulting vertices distance to the origin.

这篇关于如何在 OpenGL 中创建一个带三角形的均匀球体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆