[vtkusers] About vtkRenderWindowInteractor with Retina Resolution

Waldo Valenzuela waldo.valenzuela at hotmail.com
Sun Aug 16 05:30:52 EDT 2015


Hi Guys,

I am testing VTK 6.2 in a Qt 5.5 application. Now the display of the render is good, covers the complete area of the qtwidget, but I was playing the  vtkRenderWindowInteractor to retrieve the move position over the vtk render, and the mouse position in Y is wrong.

I have a class deviated of vtkInteractorStyleImage.

and when I want to read the mouse position I used:

vtkRenderWindowInteractor *interactor = this->GetInteractor();

    int pixel_x = interactor->GetEventPosition()[0];
    int pixel_y = interactor->GetEventPosition()[1];

the pixel position in x is correct, means that is the twice the length without retina activated.
the pixel position in y is incorrect.

I was looking others values and I found that the size of the windows are the same. 

    long w = interactor->GetSize()[0];
    long h = interactor->GetSize()[1];

meaning that if the windows size without retina is for example width: 375, height: 261, with retina activated I retrieve the values:  width: 756, height: 756. I think that this is why the computation of the mouse location in Y position is wrong.

I was trying to follow the workflow of the QVTKWidget and vtkRenderWindowInteractor, but I didn't found any error. Someone knows where I could fix this problem. 

Where in vtk source code the retina resolution is detected?

Thanks in advance for any help.

Cheers,

Waldo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150816/65ad9646/attachment.html>


More information about the vtkusers mailing list