'glm::ortho doesnt display anything
I need an orthographic projection matrix in OpenGL and I use glm for it like this:
glm::ortho(0.0f, width, 0.0f, height, zNear, zFar);
But this does not produce anything and I can't see anything on the screen. And yes, all of these values are floats.
I suspected it might be the view matrix, but I can render stuff when I use a perspective projection matrix.
Am I passing the wrong arguments? What should I do? Thanks.
Solution 1:[1]
As it was mentioned by @Rabbid76 in the comments:
float aspect = (float)width/height;
glm::ortho(-aspect, aspect, -1.0f, 1.0f, zNear, zFar);
Is the solution to my problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ams1901 |
