我想实现的功能是:在重建的三维场景中,在鼠标点处显示鼠标所指的点的三维坐标信息,可是程序运行时出现错误,一运行到下面这个函数,(即一将鼠标移到显示场景的窗口中)就得终止程序,void COpenGLWnd::OnMouseMove(UINT nFlags, CPoint point) 
{
   // TODO: Add your message handler code here and/or call default
    glGetIntegerv(GL_VIEWPORT, iViewPort); 
    glPushMatrix(); 
    glGetDoublev(GL_MODELVIEW_MATRIX, dModelMatrix); 
    glGetDoublev(GL_PROJECTION_MATRIX, dProjMatrix); 
  //  ::GetCursorPos(&point); 
  //  COpenGLWnd pwnd;
  //  ::ScreenToClient(pwnd, &point);
    glReadPixels(point.x, iViewPort[3]-point.y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &fdepth); 
    gluUnProject((GLdouble)point.x, (GLdouble)(iViewPort[3]-point.y), (GLdouble)fdepth, dModelMatrix, dProjMatrix, iViewPort, &ObjectX, &ObjectY, &ObjectZ); 
    CString str;
    str.Format("x=%,y=%d,z=%d", &ObjectX, &ObjectY, &ObjectZ);
    CPaintDC dc(this);
    ::SetBkMode( dc, TRANSPARENT );
    ::SetTextColor( dc, RGB(250,0,0) );
    ::TextOut(dc, point.x, point.y, str,str.GetLength());
    glPopMatrix(); 
    CWnd::OnMouseMove(nFlags, point);
}