View Full Version : Qt-OpenGL Zoom Problem

11-01-2009, 11:11 AM
Dear Friends
I am suceessfully able to zoom in/out in Qt application but on opengl graphics.
For zooming I am using the steps as 0.2 and intializing the zoomFactor = 1.0.
But When the value gets lower than 0.2 the it's getting out of visibility.

What kind of steps should I use so that it zooms properly as long as the object is present.
static float steps = 1.0
MyGlWidget::mouseMoveEvent(QMouseEvent *me)
if(me->y() > lastPos.y())
//zoom in
zoomFactor -= steps;
if(zoomFactor <0)
zoomFactor = 0.0;
if(zoomFactor > 6.0)
zoomFactor = 6.0;
MyGlWidget::setProjection(int w, int h)
// This code is zooming in but the zoomfactor starts from 1.0 and goes upto 0.2 after 0.2 it just disappears from the screen

// how can I control this steps so that as it gets closer the zoomFactor should slow down
//and we can see larger onto the core of the object.
//Any help would be appreciated !

11-01-2009, 12:42 PM
When zoomfactor is 0, the first argument to gluPerspective is also 0, so the field of view in the y-direction is also 0. This viewing volume has no volume; nothing fits in it, so this is the result I would expect. What exactly do you want to happen when zoomfactor is 0?