Reputation: 129
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.
Upvotes: 4
Views: 1610
Reputation: 129
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.
Upvotes: 3