1

I'm doing a 3D asteroids game in windows (using OpenGL and GLUT) where you move in space through a bunch of obstacles and survive. I'm looking for a way to set an image background against the boring bg color options. I'm new to OpenGL and all i can think of is to texture map a sphere and set it to a ridiculously large radius. What is the standard way of setting image bg in a 3d game?

4

1 回答 1

1

标准方法是绘制两个纹理映射三角形,其坐标为 x,y = +-1, z=0, w=1,其中相机和透视矩阵都设置为单位矩阵。

当然,在“空间”游戏的上下文中,人们可能希望背景旋转,自然的选择是使用立方体贴图渲染立方体(可能显示星系)。由于在背景渲染期间关闭了深度缓冲,因此立方体甚至不必“无限”大。一个单位立方体就可以了,因为没有办法知道相机离物体有多近。

于 2012-10-30T13:09:22.880 回答