PDA

View Full Version : window reshape without clipping?????



opengl_Learner
10-21-2009, 11:38 PM
hi

Can someone please tell me what modifications i should make to my code so that my object is not clipped on window resize.

float vl = -5.0, vr = 5.0, vb = -5.0, vt = 5.0;
void myGlutReshape(int x, int y)
{

glViewport(0,0,WIN_WIDTH,WIN_HEIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (WIN_WIDTH <= WIN_HEIGHT){
glOrtho(vl, vr, vl * (GLfloat WIN_HEIGHT / (GLfloat) WIN_WIDTH,
vr * (GLfloat) WIN_HEIGHT / (GLfloat) WIN_WIDTH, 0.1,10.0);
}
else
{
glOrtho(vb * (GLfloat) WIN_WIDTH / (GLfloat) WIN_HEIGHT, vt *
(GLfloat) WIN_WIDTH / (GLfloat) WIN_HEIGHT, vb, vt,0.1,10.0);
}

}