I'm trying to convert my game's camera system to use world space coordinates rather than OpenGL's default normalized device coordinates, however in doing so my sprites are being rendered improperly as you will see in the image below. Using GLM as my math library I have created a 4x4 orthographic matrix with the following code:
m_orthoMatrix = glm::ortho(0.0f, (float) m_screenWidth, (float) m_screenHeight, 0.0f);
I am then performing some translations (and scaling if by chance that is messing with anything) with the following code (m_cameraMatrix is a 4x4 matrix)
vec3 translation(-m_position.x, -m_position.y, 0.0f); m_cameraMatrix = glm::translate(m_orthoMatrix, translation); vec3 scale(m_scale, m_scale, 0.0f); m_cameraMatrix = glm::scale(mat4(1.0f), scale) * m_cameraMatrix;
m_scale is a float currently with my testing at value 1.0f. m_position is a vec2 where in the image, the sprite on the right has values (0, 0) and the sprite on the left as values (screen width / 2, 20).
The issue, as you will notice, is that the sprites are rendered upside down, and I can't seem to fix it without getting rid of my translation math and going back to normalized coordinates.