Next: 2.5.3 Handling Input Up: 2.5 Event Dispatching Previous: 2.5.1 Expose Handling

2.5.2 Window Resizing

The X server sends a ConfigureNotify event to indicate a window resize. Handling the event generally requires changing the viewport of OpenGL windows. The sample program calls glViewport specifying the window's new width and height. A resize also necessitates a screen redraw so the code ``falls through'' to the expose code which sets the needRedraw flag.

When you resize the window, the aspect ratio of the window may change (unless you have negotiated a fixed aspect ratio with the window manager as the -keepaspect option does). If you want the aspect ratio of your final image to remain constant, you might need to respecify the projection matrix with an aspect ratio to compensate for the window's changed aspect ratio. The example does not do this.


mjk@asd.sgi.com
Wed Oct 19 18:11:46 PDT 1994