How to know the view volume size


Just like glGetIntegerv(…) using GL_VIEWPORT retrieves parameters previously used to call glViewport(…), is there a way to retrieve parameters previously used to call glglOrtho(…)? Thanks for your help.


No, these calls build a projection matrix and multiply it on the currently active matrix stack (determined by your glMatrixMode calls).

You can query the projection matrix to see what’s on there. From that you can infer what call was made to glOrtho. glFrustum would be a little bit trickier to determine but definitely doable.

P.S. I think getting the projection matrix, computing the full inverse of that matrix and multiplying the corners of a unit cube as 4 component vectors back through that matrix would give you the corners of your viewing volume, in eye space.