Search code examples
openglprojection-matrix

OpenGL: Mix orthographic and perspective projection


I want to mix a perspective and orthographic view, but I can't get it to work.

I want X and Y coordinates to be orthographic and Z perspective. For clarification I added a sketch of the desired transformation from OpenGL coordinates to screen display:

sketch of desired view

(I started from a tutorial, but couldn't find how to get values top, bottom, etc.)


Solution

  • What you've drawn is simply perspective, not a mix. You just have to make sure that the viewing direction is parallel to the z axis to make the front and back faces of the box stay rectangular.