#include "mousewheel.h" #include "performzoom.h" #include void mousewheel (int button, int dir, int x, int y) { /* * Get the current coordinates, substract some fixed amount and * then perform the zoom. */ GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); /* * The step size could be either a fixed number of pixels or a percentage. */ // int step = 5; int step = (viewport[3] - viewport[1]) * 0.10; /* * Not that the focus of the zoom is currently the center of the * window but could alternatively be the mouse pointer's position. */ // Zoom in if (dir > 0) { performzoom (step, step, viewport[3] - step, viewport[3] - step); } // Zoom out else { performzoom (-step, -step, viewport[3] + step, viewport[3] + step); } return; }