View Full Version : panning

03-08-2001, 05:26 AM
below is the code for panning in OnMouseMove and onPaint - is there a better code I could use to do this in all directions - the one below isn't very acurate - it is very difficult to move the object to where you want

case Obj1Select:
CSize translate = m_RightDownPos - point;
m_RightDownPos = point;
m_Obj1PanX += translate.cx/50;
m_Obj1PanY += translate.cy/50;
m_Obj1PanZ += translate.cx/50;

when drawing the object

glTranslated(m_Obj1PanX, 0,0);
glTranslated(0, m_Obj1PanY,0);
glTranslated(0, 0, m_Obj1PanZ);