0
\$\begingroup\$

I have a scene that I'm rendering first with a perspective matrix. I then want to rerender it in a different viewport using an orthographic matrix for a top-down 2D view of the scene. I think I may be missing something because I get nothing rendered with the orthographic projection.

To setup the ortho projection I create the matrix with the near/far set to (-1,1) (not sure how it affects rendering) and then move the camera up and pitch it 90 degrees and rerender the vertices without modification.

I'm using OpenGL4 with glm to produce the matrices.

\$\endgroup\$
1
  • \$\begingroup\$ The near and far planes control the range of depths around the camera that will be rendered. With [-1, 1] as the range you will only render objects that are within 1 unit of the camera in depth. Are you sure your scene lies within that range? \$\endgroup\$ Aug 20, 2013 at 18:48

1 Answer 1

-1
\$\begingroup\$

When rendering with an ortographic projection, you need to set your model view matrix to identity.

To learn more about projection matrices, I'd suggest reading this article: http://www.songho.ca/opengl/gl_projectionmatrix.html

\$\endgroup\$
1
  • 4
    \$\begingroup\$ No, you don't "need to" set your modelview matrix to identity. You can use it to rotate and translate the view in an orthographic projection just as you do in a perspective projection. \$\endgroup\$ Aug 20, 2013 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .