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:: Add Line Numbers


:o by Kurt
void resizeGLScene(unsigned int width, unsigned int height)
{
    printf("Resizing OpenGL scene to %ix%i...\n", width, height);
    
    if(height == 0)
        height = 1;
    
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0f, width, height, 0.0f, -1.0f, 1.0f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    
    // global vars
    gwidth = width;
    gheight = height;
}