GLC_Point2d GLC_Viewport::project(const GLC_Point3d &point, bool useCameraMatrix) const { GLC_Matrix4x4 modelView; GLC_Matrix4x4 projectionMatrix; GLint viewport[4]= {0, 0, m_Width, m_Height}; if (useCameraMatrix) { modelView= m_pViewCam->modelViewMatrix(); projectionMatrix= m_ProjectionMatrix; } else { modelView= GLC_Context::current()->modelViewMatrix(); glGetIntegerv(GL_VIEWPORT, viewport); projectionMatrix= GLC_Context::current()->projectionMatrix(); } double x; double y; double z; glc::gluProject(point.x(), point.y(), point.z(), modelView.getData(), projectionMatrix.getData(), viewport, &x, &y, &z); GLC_Vector2d subject; subject.setX(x); subject.setY(y); return subject; }