球体的正投影得到圆(OpenGL——新手)
我正在尝试画一个非常简单的黑白简笔画,其头部是一个球体。背景是黑色的,我用白色绘制。球头的正投影应为线宽为 3 像素的白色圆圈。头部后面的所有内容都应该隐藏(启用 DEPTH_TEST)。我想避免使用 glu,但 glu 还可以。
实现这一目标的最简单方法是什么?
I am trying to draw a very simple, black and white stick figure whose head is a sphere. The background is black and I am drawing with white color. The orthographic projection of the sphere head should be a white circle with line width of 3 pixels. Everything behind the head should be hidden (DEPTH_TEST enabled). I would like to avoid using glut but glu is OK.
What is the simplest way to achive this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不使用球体。球体将由多个三角形组成,如果使用线条模式绘制,您最终将得到一个线框球体。 Silouhette 着色器在这里显得有些过分了。最简单的解决方案是绘制一个面向相机(=原点)的线圆,即广告牌效果。
Not using a sphere. A sphere will be composed of several triangles, and if drawn using a line mode you'll end up with a wireframe sphere. Silouhette Shaders are overkill here. The simplemost solution is drawing a line circle, that's oriented towards the camera (=origin), i.e. a billboard effect.
如果您确实想使用球体和正交投影,我建议您查看 gluSphere。
另一种选择是 gluDisk(它已经是 2D 的)。
然而,对于纯 2D 图形(听起来),我建议您考虑对圆圈使用点精灵:以圆圈作为纹理的一个四边形
http://nehe.gamedev.net/data/articles/article.asp?article=19
If you really want to use a sphere and orthographic projection I recommend looking at gluSphere.
An alternative would be gluDisk (which already is 2D).
However, for pure 2D graphics (as it sounds) I recommend that you think about using point-sprites for the circles: One Quad with the circle as texture
http://nehe.gamedev.net/data/articles/article.asp?article=19