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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With