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->button()==Qt::RightButton)
{
if(me->y() > lastPos.y())
{
//zoom in
zoomFactor -= steps;
if(zoomFactor <0)
zoomFactor = 0.0;
if(zoomFactor > 6.0)
zoomFactor = 6.0;
setProjection(width(),height());
}
}
}
MyGlWidget::setProjection(int w, int h)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(30*zoomFactor,(GLfloat)w/(GLfloat)h,1.0,100.0);
glMatrixMode(GL_MODELVIEW);
updateGL();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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 !
Bookmarks