在 3D 世界中渲染 2D 精灵? [英] Rendering 2D sprites in a 3D world?
问题描述
如果我有精灵的 png,我如何在 OpenGL 中渲染 2D 精灵?将图像作为我想要实现的效果的示例.我也想在屏幕上叠加武器,比如底部图像中的步枪.有谁知道我将如何实现这两种效果?任何帮助是极大的赞赏.
How do I render 2D sprites in OpenGL given that I have a png of the sprite? See images as an example of the effect I'd like to achieve. Also I would like to overlay weapons on the screen like the rifle in the bottom image. Does anyone know how I would achieve the two effects? Any help is greatly appreciated.
推荐答案
在 3D 术语中,这称为广告牌".广告牌是完全平坦的 2D 平面,上面有纹理,并且始终面向相机.
In 3D terms, this is called a "billboard". A billboard is completely flat 2D plane with a texture on it and it always faces the camera.
请参见此处了解纯 OpenGL 实现:http://nehe.gamedev.net/data/articles/article.asp?article=19
See here for a pure OpenGL implementation: http://nehe.gamedev.net/data/articles/article.asp?article=19
默认情况下,几乎任何 3D 引擎都应该能够做到这一点.例如,Ogre3D 可以做到.
Just about any 3D engine should be able to do them by default. Ogre3D can do it, for instance.
这篇关于在 3D 世界中渲染 2D 精灵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!