PDA

View Full Version : Image Shape and Position



ramana
10-17-2003, 09:11 PM
When i attempt to resize the window the shape of the image is changed. How to solve this one? Means always the image size and position is same when i resizing the window.

[This message has been edited by ramana (edited 10-18-2003).]

10-18-2003, 03:24 PM
You need to adjust your viewing transformation whenever you resize the window.

You don't say what windowing system interface or viewing transformation you're using. In GLUT with a perspective view you'd put glutReshapeFunc(reshape) in your init to register the reshape() method as the resize callback, then define reshape as something like:



void reshape(int w, int h)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, (double)w/(double)h, 0.1, 100.0);
glMatrixMode(GL_MODELVIEW);
}