Rendering skybox in first person shooter

Posted by brainydexter on Game Development See other posts from Game Development or by brainydexter
Published on 2011-02-05T19:16:20Z Indexed on 2011/02/05 23:33 UTC
Read the original article Hit count: 417

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: Skybox as seen when stepped back in space

© Game Development or respective owner

Related posts about rendering

Related posts about camera