getting the Ortho


OpenGL has an api glOrtho to set the Ortho, is there an api or some way to get the Ortho?


I’m not sure I understand your question; you want to get/use glOrtho(…)? This function is part of the gl core, so you should already have it.

glOrtho() does not “set the Ortho”.

glOrtho() multiplies whichever matrix happens to be the current matrix target, with a specific matrix, defined in the specification (you can read about it in the red book). It just so happens that, if the current matrix is the projection matrix, and the projection matrix is the identity matrix, then multiplying that specific matrix into the projection matrix makes for an orthographic projection.

If you want to take an arbitrary projection matrix and extract coordinates suitable for glOrtho() from it, then that’s not generally solvable, because the matrix may or may not be an orthographic projection matrix. If you KNOW that it’s an orthographic projection matrix (can be mostly found out by ensuring elements 12, 13, 14, 21, 23, 24, 31 and 32 and 34 are all zero) then you can just look at the defined Ortho matrix formula in the red book, and solve for the input arguments. That’s basic algebra.