CGPdocs

skybox_drawable

Cube map drawn around the camera as a background.

module 16_drawablesource: skybox_drawable.hpp

Fields and methods

Members of the struct skybox_drawable. Most of what you do with a CGP type goes through the free functions listed below.

Fields

opengl_shader_structure shaderShader program of the skybox, compiled from inline sources by initialize_data_on_gpu and deleted by clear.
opengl_texture_image_structure textureCubemap texture of the skybox, set by the user, bound to texture unit 0 and sent to the uniform image_skybox.
opengl_vbo_structure vbo_positionVBO storing the positions of the cube of side 2 centered at the origin, bound to shader location 0.
opengl_ebo_structure ebo_connectivityEBO storing the triangles of the skybox cube.
GLuint vao = 0OpenGL id of the Vertex Array Object of the skybox, 0 when not initialized.
affine modelModel transform sent to the uniform model, whose translation is ignored by the skybox vertex shader.
mat3 skybox_rotationRotation applied to the lookup direction in the cubemap, sent to the uniform skybox_rotation and set to identity by initialize_data_on_gpu.
float alpha_color_blending = 0.0fWeight in [0,1] of color_blending mixed with the cubemap color, sent to the uniform alpha_color_blending, 0 by default.
vec3 color_blending = vec3(1.0f, 1.0f, 1.0f)RGB color mixed with the cubemap color according to alpha_color_blending, sent to the uniform color_blending, white by default.

Methods

Compiles the inline skybox shader, uploads a cube of side 2 into a VBO, an EBO and a VAO, and resets model and skybox_rotation to identity; aborts before compiling anything if the skybox is already initialized. src
Deletes the VBO, the EBO, the VAO and the shader program, and resets texture, model and skybox_rotation without deleting the cubemap texture. src

Functions taking a skybox_drawable

Draw 1

void draw(
    skybox_drawable const& drawable,
    environment_generic_structure const& environment = environment_generic_structure()
)

Draw the skybox; call it first with depth writing disabled (glDepthMask(GL_FALSE)).

Functions returning a skybox_drawable

None.

Operators

None.

CGP - Computer Graphics Programming.