This tutorial offers a nearly perfect guide of creating a skybox using OpenGL. I propose, for example, in C++, creating a class which contains two modules:
1. Loading texture images, the details of which can also be found in the tutorial. We need to load 6 texture images.
2. Creating the box, elaborated in the tutorial. It is about rendering a cube and attached the texture to each face.
However, it does not seem so easy. There are 2 tricky things.
1. We need to determine which image to attach to each face. Typically the 6 skybox images used to be a seamless *image* describing a view of the environment. So the order is unique to reconstruct the original environment. Make sure the front, back, left, right, top and bottom images are correct.
2. Normally after you are done you will see a very disturbing *white lines* on the edges of the faces, making the environment unreal. To eliminate the *white lines*, configure the texture thing as follows:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // to eliminate *white edge* effect glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
And the *white lines* would go away.