From b7a196ba4a6a377ea8717a37bac7d21371e5bbba Mon Sep 17 00:00:00 2001 From: cyaneko <41419822+cyaneko@users.noreply.github.com> Date: Thu, 19 Aug 2021 21:10:57 +0200 Subject: [PATCH] Fix a minor bug in rear view mirror Rotating both the Yaw and Pitch would cause the mirror to display whatever was in front but with Pitch * -1, this fixes this behaviour. Tested. --- .../5.2.framebuffers_exercise1/framebuffers_exercise1.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp index 2682a96..c6d30d5 100644 --- a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp +++ b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp @@ -250,11 +250,9 @@ int main() shader.use(); glm::mat4 model = glm::mat4(1.0f); camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around - camera.Pitch += 180.0f; // rotate the camera's pitch 180 degrees around camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values) glm::mat4 view = camera.GetViewMatrix(); camera.Yaw -= 180.0f; // reset it back to its original orientation - camera.Pitch -= 180.0f; camera.ProcessMouseMovement(0, 0, true); glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f); shader.setMat4("view", view);