Issue with ortho projection on Vulkan
Opened this issue · 2 comments
gamecoder-nz commented
I'm sure I'm doing something wrong but I can't figure out what. I have an orthographic projection like this
m_AspectRatio = (float)width / (float)height;
float orthoLeft = 0.0f;
float orthoRight = (float)m_OrthographicHeight * m_AspectRatio * m_Zoom;
float orthoTop = (float)m_OrthographicHeight * m_Zoom;
float orthoBottom = 0.0f;
m_Projection = glm::ortho(orthoLeft, orthoRight, orthoBottom, orthoTop, (float)m_OrthographicNear, (float)m_OrthographicFar);
glm::mat4 transformationMatrix = glm::translate(glm::mat4(1.0f), m_Position);
m_View = glm::inverse(transformationMatrix);
The camera doesn't rotate and stays at z = 10 but the y axis for the guizmo is inverted. It is pointing the wrong direction and drags in the wrong direction.
gamecoder-nz commented
If I create another matrix where the top and bottom are swapped like this
glm::ortho(orthoLeft, orthoRight, orthoTop, orthoBottom, (float)m_OrthographicNear, (float)m_OrthographicFar);
Then it works
gamecoder-nz commented
It also works if I swap the projection matrices around. So the top and bottom for ImGuizmo has to be the opposite of what's used for the engine.