opengl如何实现鼠标平移物体

我想实现鼠标左键拖动物体,但是我仿照http://blog.csdn.net/yulinxx/article/details/39256965改的代码,鼠标一点击物体就消失了,
void CDrawCubeDemoView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_MouseDownPoint=point;
SetCapture();
CView::OnLButtonDown(nFlags, point);
}

void CDrawCubeDemoView::OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
CView::OnLButtonUp(nFlags, point);
}

void CDrawCubeDemoView::OnMouseMove(UINT nFlags, CPoint point)
{
m_xPos+=(point.x-m_MouseDownPoint.x)*2;
m_yPos+=(m_MouseDownPoint.y-point.y)*2;
m_MouseDownPoint=point;
glTranslated(m_xPos, m_yPos, -10.0);

CView::OnMouseMove(nFlags, point);

}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐