Rendering skybox in first person shooter
- by brainydexter
I am trying to get a skybox rendered correctly in my first person shooter game. I have the skybox cube rendering using GL_TEXTURE_CUBE_MAP. I author the cube with extents of -1 and 1 along X,Y and Z.
However, I can't wrap my head around the camera transformations that I need to apply to get it right. My render loop looks something like this:
mp_Camera-ApplyTransform() :: Takes the current player transformation and inverts it and pushes that on the modelview stack.
Draw GameObjects
Draw Skybox
DrawSkybox does the following:
glEnable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_FALSE);
// draw the cube here with extents
glDisable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_TRUE);
Do I need to translate the skybox by the translation of the camera ? (btw, that didn't help either)
EDIT: I forgot to mention: It looks like a small cube with unit extents. Also, I can strafe in/out of the cube.
Screenshot: