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:
glMatrixMode(PROJECTION);
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?

Thanks.

This is documented in the specification

http://www.opengl.org/documentation/spec…000000000000000

and in the man page for glOrtho

http://www.hmug.org/man/3/glOrtho.php

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

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


                                          -2
            0              0         ------------        tz
                                      zFar-zNear

            0              0              0              1


       where

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

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

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

Thanks alot. This is very helpful.