Course list http://www.c-jump.com/bcc/
|
|
Cube map background applied:
Reflection cube map:
Create and bind texture buffer
Upload images by glTexImage2D(). For example,
glTexImage2D(
GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA,
w, h, 0, GL_BGR, GL_UNSIGNED_BYTE, bitmap_data );
where texture targets are
GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
Use GL_TEXTURE_CUBE_MAP target texture
Continue using magnification and minification filters
Specify how to wrap each texture coordinate. For example,
glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
Skybox is a giant box with texture image on every side
It surrounds the camera and never moves anywhere
It rotates with the rest of the world
The fragment shader uses sampleCube variable to sample the texels
|
|
Cube map reflections, OpenGL Superbible: