Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
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? –  Nathan Reed Aug 20 '13 at 18:48

1 Answer 1

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

share|improve this answer
2  
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. –  Nathan Reed Aug 20 '13 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.