commit 578f5f2d2aa69e33fd91924fa6fe717cae30912d parent 949e56383e5730a294c7c0bee6ece5d9edc36a25 Author: Michael Savage <mikejsavage@gmail.com> Date: Thu Sep 8 22:22:23 -0700 Use a 3x3 view matrix in the skybox shader Diffstat:
skybox.cc | | | 6 | +++--- |
diff --git a/skybox.cc b/skybox.cc @@ -22,7 +22,7 @@ static const GLchar * const vert_src = GLSL( out vec3 pos; - uniform mat4 V; + uniform mat3 V; void main() { // gl_Position = vec4( ( V * vec4( position, 1.0 ) ).xy, 1.0, 1.0 ); @@ -78,7 +78,7 @@ void skybox_render( const Skybox * skybox, const glm::vec3 & angles ) { glUseProgram( skybox->shader ); glBindVertexArray( skybox->vao ); - const glm::mat4 V = glm::rotate( + const glm::mat3 V = glm::mat3( glm::rotate( glm::rotate( glm::mat4(), angles.x, @@ -86,7 +86,7 @@ void skybox_render( const Skybox * skybox, const glm::vec3 & angles ) { ), angles.y, glm::vec3( 0, 0, 1 ) - ); + ) ); glUniformMatrix4fv( skybox->un_v, 1, GL_FALSE, glm::value_ptr( V ) );