There are three ways to do this:
- Sky box
- Sky dome
- Sky plane
With a sky box
, you have a giant box that is surrounding your scene. This will make it seem as if you are in a 'box'. With a sky dome
, you have the same box, but this time the projection of the texture onto the cube is spherical. Problem with this technique is that the projection does not cover the bottom of the cube (which is not a problem in most cases). You can also go with a literal dome, that is, a sphere (which Kromster suggested), although it comes with its own share of problems (pinch points). Then there is the sky plane
where only one (very large) plane is rendered. The drawback here is that you will see the horizon, so you can only use this technique in closed areas.
As for keeping the sky where it is when you move etc. Kromster suggestion is correct. You will want to, however, make sure that all your objects are rendered on top of the sky. This is very easy to do, simply render your sky first, then without swapping buffers, render your scene.
NOTE: All the sky types have their polygon normals inverted. So if you have a box or a sphere mesh, invert the normals otherwise you will not see anything.