Help using GLOrtho

Posted by user146780 on Stack Overflow See other posts from Stack Overflow or by user146780
Published on 2010-06-06T20:43:32Z Indexed on 2010/06/06 20:52 UTC
Read the original article Hit count: 335

Filed under:
|
|

I resize my window like this:

    RECT clientRect;
    GetClientRect(mainWindow,&clientRect);

    glShadeModel(GL_SMOOTH);

MoveWindow(framehWnd,
        toolWidth,
        tabHeight, 
        ((clientRect.right - clientRect.left) - toolWidth) - rightRemainder , 
        (clientRect.bottom - clientRect.top) - tabHeight - paramHeight, 
        false);


glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho (0, ((clientRect.right - clientRect.left) - toolWidth) - rightRemainder ,
         (clientRect.bottom - clientRect.top) - tabHeight - paramHeight
         , 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

This works fine except for one thing. Lets say I create a square at 0,0 to 100, 100. I'd like if I resize that it always stays at the top left but right now if I resize it gets pushed up or down instead of staying at the top left. What should I modify? Thanks

*I just realized what really would need to happen is for the context to resize, but i'm not sure how to do this without throwing out the OGL context and re initing it.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c