Seamless cube map with opengl
Alec Jacobson
May 27, 2011
I was experimenting with cube maps today using opengl's reflection map functions. At first I was very annoyed by the seams I was getting between the sides of my cubes reflected on the shape's in the scene. Turns out I was using the wrong wrapping setting. You can set the texture wrapping via:
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, wrap);
where wrap
is a valid wrap enum value. For seamless reflection mapping use either GL_CLAMP_TO_EDGE or GL_MIRRORED_REPEAT. Here's a comparison of the results of each valid setting: