20-02-2021, 10:20 AM
Mouse Selection in OpenGL by Bahrudin Hrnjica
void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_LeftButtonDown = TRUE;
m_LeftDownPos = point;
SetCapture();
CMyDoc* pDoc = (CMyDoc*)GetDocument();
ASSERT(pDoc);
CTypedPtrList<CObList,CSphere*>& sphereList =pDoc->m_SphereList;
POSITION pos = sphereList.GetHeadPosition();
while (pos != NULL)
{
CSphere* spheres = sphereList.GetNext(pos);
spheres->m_Select=FALSE;
if(spheres->GetRect().PtInRect(point))
{
m_sph=spheres;
m_sph->m_Select=TRUE;
}
}
Invalidate();
CView::OnLButtonDown(nFlags, point);
}
https://www.codeproject.com/Articles/309...enGL-Scene
void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_LeftButtonDown = TRUE;
m_LeftDownPos = point;
SetCapture();
CMyDoc* pDoc = (CMyDoc*)GetDocument();
ASSERT(pDoc);
CTypedPtrList<CObList,CSphere*>& sphereList =pDoc->m_SphereList;
POSITION pos = sphereList.GetHeadPosition();
while (pos != NULL)
{
CSphere* spheres = sphereList.GetNext(pos);
spheres->m_Select=FALSE;
if(spheres->GetRect().PtInRect(point))
{
m_sph=spheres;
m_sph->m_Select=TRUE;
}
}
Invalidate();
CView::OnLButtonDown(nFlags, point);
}
https://www.codeproject.com/Articles/309...enGL-Scene