hi,
i have written code in keypressevent like below
void GLWidget
::KeyPressEvent(QKeyEvent *event
) {
switch(event->key())
{
case Qt::Key_Home :
sBoundingBox.fMinX=-180;
sBoundingBox.fMinY=-90;
sBoundingBox.fMaxX=+180;
sBoundingBox.fMaxY=+90;
break;
case Qt::Key_Plus :
sBoundingBox.fMinX += 1000.0;
sBoundingBox.fMaxX -= 1000.0;
sBoundingBox.fMinY += 1000.0;
sBoundingBox.fMaxY -= 1000.0;
break;
case Qt::Key_Minus :
sBoundingBox.fMinX -= 1000.0;
sBoundingBox.fMaxX += 1000.0;
sBoundingBox.fMinY -= 1000.0;
sBoundingBox.fMaxY += 1000.0;
break;
}
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho(sBoundingBox.fMinX, sBoundingBox.fMaxX,sBoundingBox.fMinY,sBoundingBox.fMaxY,-1,1);
glMatrixMode(GL_MODELVIEW);
//glIdleFunc(paintGL);
paintGL();
}
void GLWidget::KeyPressEvent(QKeyEvent *event)
{
switch(event->key())
{
case Qt::Key_Home :
sBoundingBox.fMinX=-180;
sBoundingBox.fMinY=-90;
sBoundingBox.fMaxX=+180;
sBoundingBox.fMaxY=+90;
break;
case Qt::Key_Plus :
sBoundingBox.fMinX += 1000.0;
sBoundingBox.fMaxX -= 1000.0;
sBoundingBox.fMinY += 1000.0;
sBoundingBox.fMaxY -= 1000.0;
break;
case Qt::Key_Minus :
sBoundingBox.fMinX -= 1000.0;
sBoundingBox.fMaxX += 1000.0;
sBoundingBox.fMinY -= 1000.0;
sBoundingBox.fMaxY += 1000.0;
break;
}
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho(sBoundingBox.fMinX, sBoundingBox.fMaxX,sBoundingBox.fMinY,sBoundingBox.fMaxY,-1,1);
glMatrixMode(GL_MODELVIEW);
//glIdleFunc(paintGL);
paintGL();
}
To copy to clipboard, switch view to plain text mode
but program is not enterint at all into this fuction
can anyone help me?
thanks and regards
k. bhogasena reddy
Bookmarks