GltZPR Logo OpenGL

GLT ZPR - Zoom, Pan and Rotate

GLT ZPR is a mouse manipulation module for C or C++ GLUT/OpenGL programs. With the addition of two lines of code, any GLUT based OpenGL program can include mouse-based zooming, panning and rotation.

The module works by supplying GLUT callback functions for glutReshapeFunc, glutMouseFunc and glutMotionFunc. These provide VRML examiner-style mouse manipulation using the left, middle and right mouse buttons. The middle button can be emulated by using both left and right together. The ZPR callback functions will manage the OpenGL modelview matrix, according to mouse events received via GLUT.

GLT ZPR can be included in any C or C++ application by adding zpr.c and zpr.h. The zprInit() function should be called after the window is created (glutCreateWindow) and the initial scaling and orientation has been set.

A sample program zprdemo.c is also included.


LinuxCygwinSGI   Linux/Unix Sources

GltZpr 0.4 gltZpr0.4.tgz (9 Kb)
MD5 checksum: fb459a19ce54c33ef36b37f9fa48a029

Windows   Windows Demo & Source (95/98/NT/2000)

GltZpr 0.4 gltZpr0.4.exe (380 Kb)
MD5 checksum: 6d9724a18042a5a52433944c4db8bfed

GltZpr 0.4 (11 Kb)
MD5 checksum: bf4a997dda5fcf267c414ee131b1db84

Known Issues

  • For best results, the object should be centered on the origin.
  • Only one GLUT window can use the zpr module at a time.
  • Use an orthographic projection, rather than perspective.
  • Fog behaves strangely when combined with ZPR zooming.
  • Configure zNear and zFar clipping planes carefully.
  • ZPR manipulates the OpenGL modelview matrix, push() and pop() as necessary.


Visualising atom structures produced by Simulated Annealing

Simulated Annealing

Input data in the form of 2D or 3D co-ordinates taken from Monte Carlo simulations. The process of simulated annealing may result in crystal lattice structures, best viewed and analysed in three dimensions. Using GLT ZPR, this simple OpenGL application was hacked together in 1.5 days.

Courtesy of Joseph Antony

Visualising the Lorenz Attractor

Lorenz Attractor

The Lorenz Attractor is a simple system of non-linear first order differential equations. (The velocity at each position is a function of x,y and z.) Paths traced through the attractor exhibit characteristics of of Chaos - sensitivity to initial conditions and long-term unpredicitability (dynamic instability).

Since the Lorenz Attractor is a fundamentally three-dimensional, it can be best appreciated interactively with the facility to zoom, pan and rotate.

Visualising an Ant Colony

Crazy Ants

As part of an introductory graphics programming course, students were asked to model an ant colony. Many made use of ZPR for mouse navigation of their 3D interactive models.

My thanks to the Interactive3D class of 2003 for an interesting and entertaining semester.

Courtesy of Bok Thye Yeow

Spherical Harmonics

Spherical Harmonics

A program called SHG demonstrates principles of spherical harmonics using GLT ZPR.

Courtesy of Adomas Paltanavi


GltZpr0.4 Oct 22 2003

Added support for mouse picking using OpenGL selection mode.

GltZpr0.2 Mar 7 2003

Added support for application-specified center of rotation and zooming.

GltZpr0.1 Sep 15 2001

Initial release.


GLT source code available under LGPL.

No warranty, no responsibility taken.
This software is considered a stable release.


Similar functionality

Other GLT Software