Convert mouse position

2019-08-31 08:53发布

问题:

I have following code:

int p[2];
m_pRenderWindow->GetInteractor()->GetEventPosition(p);
vtkRenderer* pFoundRenderer = m_pRenderWindow->GetInteractor()->FindPokedRenderer(p[0], p[1]);

if(m_pRenderer2 == pFoundRenderer)
{
    // do something
}

On the m_pRenderWindow I have 4 renderers ... when the m_pRenderWindow is restored, (is not spread on entire screen for instance), p[0] and p[1] are NOT correct ( when the mouse is over a renderer3 the code says that the mouse is over renderer2, or something) ... why ?

I guess that mouse coordinates should be converted into client coordinates ... but how ?

标签: 3d vtk