setting/updating the PROJECTION matrix using glLoadMatrix()

I’m working on an exercise where I’m keeping total track of the PROJECTION and MODELVIEW matrix stacks myself using my own data structures, and updating the actual PROJECTION/MODELVIEW matrix only when needed using glLoadMatrix()

I’ve done the necessary functions for modifying the MODELVIEW matrix (my own glrotate, gltranslate, glscale, glPop, glPush “type” functions), and its working as expected.

I’m not sure about projection matrix… What happens to the PROJECTION matrix when the following is done:
glLoadIdentity(); //obvious here…
glOrtho3d(); //but what about after this?

Could anyone give me some hints as to how to set up the PROJECTION matrix. Or maybe a link to where I could learn more about it?


This is documented in the specification…000000000000000

and in the man page for glOrtho

        ------------       0              0              tx
        right - left

            0         ------------        0              ty
                      top - bottom

            0              0         ------------        tz

            0              0              0              1


                       tx = - (right + left) / (right - left)

                       ty = - (top + bottom) / (top - bottom)

                       tz = - (zFar + zNear) / (zFar - zNear)

Thanks alot. This is very helpful.