From 207170c2c0c3dfa7c2bdb8a9cdd4d8b89fbaec27 Mon Sep 17 00:00:00 2001 From: WhoLeb <44871223+WhoLeb@users.noreply.github.com> Date: Fri, 22 Sep 2023 17:26:09 +0300 Subject: [PATCH] Update orthographic projection matrix In orthographic projection all objects were flipped. This change fixes it! --- src/lve_camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lve_camera.cpp b/src/lve_camera.cpp index d1a13ab..dbbf145 100644 --- a/src/lve_camera.cpp +++ b/src/lve_camera.cpp @@ -10,10 +10,10 @@ void LveCamera::setOrthographicProjection( float left, float right, float top, float bottom, float near, float far) { projectionMatrix = glm::mat4{1.0f}; projectionMatrix[0][0] = 2.f / (right - left); - projectionMatrix[1][1] = 2.f / (bottom - top); + projectionMatrix[1][1] = 2.f / (top - bottom); projectionMatrix[2][2] = 1.f / (far - near); projectionMatrix[3][0] = -(right + left) / (right - left); - projectionMatrix[3][1] = -(bottom + top) / (bottom - top); + projectionMatrix[3][1] = -(bottom + top) / (top - bottom); projectionMatrix[3][2] = -near / (far - near); }