PDA

View Full Version : panning



bhogasena
01-27-2009, 07:21 AM
hi,
i rendered map in opengl.i stucked at zoomind and panning.
i have wriiten code for zooming as
code:
float fXZoomFactor=1.0f;
float fYZoomFactor=1.0f;
fXZoomFactor=fabs(sBoundingBox.fMaxX-sBoundingBox.fMinX)*0.1;
fYZoomFactor=fabs(sBoundingBox.fMaxY-sBoundingBox.fMinY)*0.1;
sBoundingBox.fMinX += fXZoomFactor;
sBoundingBox.fMaxX -= fXZoomFactor;
sBoundingBox.fMinY += fYZoomFactor;
sBoundingBox.fMaxY -= fYZoomFactor;



glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
GLdraw();
}

glOrtho(sBoundingBox.fMinX, sBoundingBox.fMaxX,sBoundingBox.fMinY,sBoundingBox .fMaxY,-1,1);
glMatrixMode(GL_MODELVIEW);
i put this code in slot when button is clicked
but problem is when button is clicked it is updating.once i clicked button and then again on screen it is updatinng.

when it is zoom mode i would like to pan map.please send me a sample code for panning please


please tell me solution for this so that i'll be thankful to you.