Hi, I just created an enviroment texture. I mapped a 3D cubemap to a big cube. Here is what I did:
1.Loading 3D cubemap texture:
GLuint _enviroment_tex_cube = SOIL_load_OGL_single_cubemap (
"stormydays_large_cube.jpg",
"NESWUD",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS
);
2.Mapping texture to a cube:
void drawEnviroment()
{
glEnable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_CUBE_MAP, _enviroment_tex_cube);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBegin(GL_QUADS);
//Top face
glColor3f(1.0f, 1.0f, 1.0f);
glNormal3f(0.0, 1.0f, 0.0f);
glTexCoord3f(-1.0f, 1.0f, -1.0f);
glVertex3f(-ENVIROMENT_BOX_SIZE / 2, ENVIROMENT_BOX_SIZE / 2, -ENVIROMENT_BOX_SIZE / 2);
glTexCoord3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-ENVIROMENT_BOX_SIZE / 2, ENVIROMENT_BOX_SIZE / 2, ENVIROMENT_BOX_SIZE / 2);
glTexCoord3f(1.0f, 1.0f, 1.0f);
glVertex3f(ENVIROMENT_BOX_SIZE / 2, ENVIROMENT_BOX_SIZE / 2, ENVIROMENT_BOX_SIZE / 2);
glTexCoord3f(1.0f, 1.0f, -1.0f);
glVertex3f(ENVIROMENT_BOX_SIZE / 2, ENVIROMENT_BOX_SIZE / 2, -ENVIROMENT_BOX_SIZE / 2);
… Repeating for each side of the cube. That is 6 sides …
glEnd();
glDisable(GL_TEXTURE_CUBE_MAP);
}
The cube is mapping correctly. Except a little detail … the edges of the cube doesen’t look stick together. There are tiny crack-lines along the ecach cube’s edges where the two adjacent sides from the cube are supposed to meet. It looks like that:
From different viewer’s angle these crack-lines are not evident:
I remember from my teen-age gaming experience that some games have had similar problems, but I’m not sure if this problem is still common and whether in modern games it may be found?