GLUI and window resize
hi. i am using glui to make my ui. anyway, i just noticed (after a few weeks) that when i resize my window, the image gets stretched, it does not maintain the correct aspect ratio. i know, i know, i should have found this sooner, but i was spending all my time on programming, i never thought to resize. my code to resize is:
void reshape(int w1, int h1){
int tx, ty, tw, th;
GLUI_Master.get_viewport_area( &tx, &ty, &tw, &th);
h = tw;
w = tw;
if (h == 0)
h = 1;
ratio = 1.0f * w/h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLUI_Master.auto_set_viewport();
gluPerspective(45, ratio, 0.1,1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(x,y,z,x+lx,y+ly,z+lz,0.0f,1.0f,0.0f);
}
i know that GLUI does some thingss to automatically make keep itself the same size. does anyone know a way to fix the stretch problem? also, is there way to find the dimensions of the window, without the UI? i want to hide the mouse when it is over hte opengl, but not when i go to the UI.
by the way, my glui window is attached if that makes a difference. Thanks in advance.
Jason
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement