<div dir="ltr">Hi Kevin,<div><br></div><div>The issue seems to be related to the retina display and maybe macOS sierra.</div><div><br></div><div>Which version of VTK are you using? I know that I fixed some picking issue on mac with retina display before Sierra. </div><div><br></div><div>The change I'm talking about is:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">commit b6df993770cfcd9a69a48a2730415a992d698c5b<br>Author: Sebastien Jourdain <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>><br>Date: Fri Jul 8 09:45:58 2016 -0400<br> Fix VTK/Java JOGL<br> <br> - Update JOGL version to 2.32<br> - Update documentation on how to download the JOGL jars with Maven<br> - Add support for Retina display<br></blockquote></div><div><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(0,0,0);color:rgb(255,213,0);font-family:menlo;font-size:11px"><br></span></div><div>Ideally, you should make sure you have this commit in your VTK and that is working on system older than Sierra. Then if Sierra is the issue, I think more advanced debugging may be require. Although, VTK compiled on an older OS should work just fine on Sierra. <span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(0,0,0);color:rgb(255,213,0);font-family:menlo;font-size:11px"><br></span></div><div><br></div><div>Let me know if you find out more about it.</div><div><br></div><div>Seb</div><div><br></div>
</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 1, 2017 at 5:19 PM, Kevin Milner <span dir="ltr"><<a href="mailto:kmilner@usc.edu" target="_blank">kmilner@usc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello. I develop a VTK Java application for visualizing georeferenced earthquake data, SCEC-VDO (<a href="http://scecvdo.usc.edu/" rel="noreferrer" target="_blank">http://scecvdo.usc.edu/</a>). One of the important features of this software is the ability to click on elements of the 3D view to perform actions or view information. This works perfectly on Windows and Linux, but does not work on Macs. I believe that this is due to an internal bug in the Mac version of VTK. We use the vtkJoglPanelComponent to embed the 3D view into our Java application.<br>
<br>
Here is the code that I use to pick items (where renderWindow is a vtkJoglPanelComponent):<br>
<br>
renderWindow.getComponent().ad<wbr>dMouseListener(new MouseAdapter() {<br>
public void mousePressed(MouseEvent e) {<br>
int[] clickPos = renderWindow.getRenderWindowIn<wbr>teractor().GetEventPosition();<br>
<br>
int x = clickPos[0];<br>
int y = clickPos[1];<br>
<br>
cellPicker.Pick(x, y, 0, renderWindow.getRenderer());<br>
if (cellPicker.GetActor() != null) {<br>
// do stuff<br>
...<br>
}<br>
}<br>
});<br>
<br>
The first bug is that the y value of getRenderWindowInteractor().Ge<wbr>tEventPosition() is just flat out wrong on the Mac (correct on Windows and Linux). For example, if I click near the top of my window with height 700, if will give me a y value that is greater than 1300! It should actually be very small, as y should be zero at the top of the window and 700 at the bottom of the window. I can get around this, and make it match the position on Linux/Windows with the following fix using the mouseEvent (e) and the height of the 3D view component:<br>
<br>
int height = renderWindow.getComponent().ge<wbr>tHeight();<br>
int calcY = (height - e.getY()) - 1;<br>
int x = e.getX();<br>
int y = calcY;<br>
<br>
Now when I click on a location in the 3D viewer, the x/y coordinates match the results on Linux/Windows. But picking actors still doesn't work. Instead, VTK thinks that I have clicked somewhere roughly between where I actually clicked and the bottom left corner. So if I click on the top right corner of the viewer, it thinks that I clicked in the middle. If I click on the top left, if thinks that I clicked middle left. If I click on the middle of the viewer, it thinks that I clicked 1/4 up and right of the lower left corner. I have posted a video which demonstrates this bug:<br>
<br>
<a href="http://sendvid.com/yqz1qww2" rel="noreferrer" target="_blank">http://sendvid.com/yqz1qww2</a><br>
<br>
In this video, whatever actor is clicked turns red. This works as expected on Windows/Linux, both with and without the x/y fix mentioned above. Without the previous fix on a Mac, the behavior is similar but centered around the top left corner and sometimes doesn't detect clicks at all (due to y values which make no sense).<br>
<br>
Any ideas what could be going on? I have experienced this behavior on all 4 Mac's on which I have tried the software.<br>
<br>
Thanks,<br>
Kevin Milner<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/vtkusers</a><br>
</blockquote></div><br></div>