GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


anything wrong with doing this? by godecho
1
 
void ScreenMgr::Screen::SetOrthoProj() const
{
    StateMgr::Inst()->StateDisable(GL_DEPTH_TEST);    // Turn depth testing off

    glMatrixMode(GL_PROJECTION);                    // Switch to projection mode
    glPushMatrix();                                    // Save previous matrix which contains the settings for the perspective projection
    glLoadIdentity();

    glOrtho(0, width, 0, height, -1, 1);
    glMatrixMode(GL_MODELVIEW);
}

void ScreenMgr::Screen::ResetPersProj() const
{
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();                                    // Pop the stack
    glMatrixMode(GL_MODELVIEW);                        // Put us back in modelview mode                                            

    StateMgr::Inst()->StateEnable(GL_DEPTH_TEST);    // Turn depth testing back on
}

/* when i want to do something with pixel coordinates, say render text, i make a call to the first function.  I do all of my text drawing, then make a call to this second function.  i was wondering if this constitutes as projection mode abuse or not. */

 
Comments by GLProgramming users
 
Comment by DELTRON 22:14:10 12/May/2004 


    nope :D