[vtkusers] Issues with picking in VTK Java on Mac OS X

Kevin Milner kmilner at usc.edu
Fri Feb 3 18:02:36 EST 2017


OK I have finally successfully rebuilt VTK with Java support from 
git/master (details in below thread that I left off of the list), but 
unfortunately both Picking issues still exist:

* vtkJoglPanelComponent.getRenderWindowInteractor().GetEventPosition() 
still returns bogus y values (e.g. >1300 for a window of height 700)
* once the above is addressed via previously described workaround, VTK 
still thinks that I clicked halfway between where I actually clicked and 
the lower left corner of the window (as demonstrated in this video: 
http://sendvid.com/yqz1qww2)

So unfortunately Sebastien's commit didn't solve my issues.

I'm testing on a MacBook Pro (Retina, 13-inch, Early 2013) with OSX 
Yosemite 10.10.5, but have experienced the same behavior on other Macs.

Any other ideas? Any information that I can provide that would be helpful?

Thanks,
Kevin

On 02/03/2017 12:41 PM, Sebastien Jourdain wrote:
> can you try on git/master? I remember something about the wrapper that 
> was buggy at some point.
>
> On Fri, Feb 3, 2017 at 1:18 PM, Kevin Milner <kmilner at usc.edu 
> <mailto:kmilner at usc.edu>> wrote:
>
>     I'm running into some compilation issues trying to build the
>     latest version, both on the Mac and on Linux. Have you encountered
>     this?
>
>     VTK-7.1.0/build/java/vtk/sample/rendering/JoglConeRendering.java:77:
>     error: cannot find symbol
>             scalarBar.GetScalarBarActor().SetTitle("Example");
>                      ^
>       symbol:   method GetScalarBarActor()
>       location: variable scalarBar of type vtkScalarBarWidget
>
>     I'm using the latest JOGL jars, 2.3, specifying paths to
>     jogl-all.jar and gluegen-rt.jar.
>
>     Thanks,
>     Kevin
>
>
>     On 02/02/2017 09:35 AM, Sebastien Jourdain wrote:
>>     We have, and our dashboard were producing them for a while, but
>>     when we switch to buildbot all that went away.
>>
>>     In fact, I would even love to publish them to maven but never get
>>     funding support for it. And very few people at Kitware know how
>>     to deal with Java.
>>
>>     On Thu, Feb 2, 2017 at 10:30 AM, Kevin Milner <kmilner at usc.edu
>>     <mailto:kmilner at usc.edu>> wrote:
>>
>>         Hmm, OK, I didn't actually build the libraries (one of my
>>         colleagues did), I just looked in my VTK lib folder on the
>>         Mac and there were files named, for example,
>>         "libvtkalglib-7.0.1.dylib", so that's where I got 7.0.1 from.
>>         But they were built right around July 2016 so I imagine that
>>         they don't include the fix! I'll report back tomorrow once I
>>         figure out how to build it on a Mac. I'm not sure which OS
>>         the Mac I'm using for testing is but I imagine that it's not
>>         Sierra as it's a couple years old and likely has not been
>>         kept up to date. I'm a Linux user and not up to date on
>>         anything Mac related. Will report back tomorrow.
>>
>>         Have you guys ever considered releasing binaries of VTK-Java?
>>         Would be really helpful!
>>
>>         Thanks,
>>         Kevin
>>
>>
>>         On 2/2/2017 9:23 AM, Sebastien Jourdain wrote:
>>>         It seems like 7.1.0 does have my change but not 7.0.0. Which
>>>         make me think it might be a Sierra issue if you are using
>>>         7.1 not 7.0.1 since the latter does not exist.
>>>
>>>         Which OS are you on? (When you will get back to it ;-)
>>>
>>>         On Thu, Feb 2, 2017 at 10:13 AM, Kevin Milner
>>>         <kmilner at usc.edu <mailto:kmilner at usc.edu>> wrote:
>>>
>>>             Thanks Sebastien!
>>>
>>>             I'm not near a Mac today but will try rebuilding
>>>             tomorrow to see if your fix does the trick. I'm
>>>             currently on 7.0.1, is your patch included in the 7.1
>>>             release or should I check out the latest dev version?
>>>             I'll report back to the list when I find out if it works.
>>>
>>>             Thanks a lot,
>>>             Kevin
>>>
>>>
>>>             On 2/1/2017 4:58 PM, Sebastien Jourdain wrote:
>>>>             Hi Kevin,
>>>>
>>>>             The issue seems to be related to the retina display and
>>>>             maybe macOS sierra.
>>>>
>>>>             Which version of VTK are you using? I know that I fixed
>>>>             some picking issue on mac with retina display before
>>>>             Sierra.
>>>>
>>>>             The change I'm talking about is:
>>>>
>>>>                 commit b6df993770cfcd9a69a48a2730415a992d698c5b
>>>>                 Author: Sebastien Jourdain
>>>>                 <sebastien.jourdain at kitware.com
>>>>                 <mailto:sebastien.jourdain at kitware.com>>
>>>>                 Date:   Fri Jul 8 09:45:58 2016 -0400
>>>>                     Fix VTK/Java JOGL
>>>>
>>>>                     - Update JOGL version to 2.32
>>>>                     - Update documentation on how to download the
>>>>                 JOGL jars with Maven
>>>>                     - Add support for Retina display
>>>>
>>>>
>>>>             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.
>>>>
>>>>             Let me know if you find out more about it.
>>>>
>>>>             Seb
>>>>
>>>>
>>>>             On Wed, Feb 1, 2017 at 5:19 PM, Kevin Milner
>>>>             <kmilner at usc.edu <mailto:kmilner at usc.edu>> wrote:
>>>>
>>>>                 Hello. I develop a VTK Java application for
>>>>                 visualizing georeferenced earthquake data, SCEC-VDO
>>>>                 (http://scecvdo.usc.edu/). 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.
>>>>
>>>>                 Here is the code that I use to pick items (where
>>>>                 renderWindow is a vtkJoglPanelComponent):
>>>>
>>>>                 renderWindow.getComponent().addMouseListener(new
>>>>                 MouseAdapter() {
>>>>                             public void mousePressed(MouseEvent e) {
>>>>                 int[] clickPos =
>>>>                 renderWindow.getRenderWindowInteractor().GetEventPosition();
>>>>
>>>>                 int x = clickPos[0];
>>>>                 int y = clickPos[1];
>>>>
>>>>                 cellPicker.Pick(x, y, 0, renderWindow.getRenderer());
>>>>                                 if (cellPicker.GetActor() != null) {
>>>>                   // do stuff
>>>>                   ...
>>>>                                 }
>>>>                             }
>>>>                         });
>>>>
>>>>                 The first bug is that the y value of
>>>>                 getRenderWindowInteractor().GetEventPosition() 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:
>>>>
>>>>                 int height = renderWindow.getComponent().getHeight();
>>>>                 int calcY = (height - e.getY()) - 1;
>>>>                 int x = e.getX();
>>>>                 int y = calcY;
>>>>
>>>>                 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:
>>>>
>>>>                 http://sendvid.com/yqz1qww2
>>>>                 <https://urldefense.proofpoint.com/v2/url?u=http-3A__sendvid.com_yqz1qww2&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=Ut0P5Kplo2cIO9V0et1UBQ&m=PGkWSB3OSZwzyAuWZpoUrTh6vHu2mHd7spHGazrOstc&s=dGJsjDO5nIImoI6O_DyWJiDnyBMEcib-RQEYnrPh9rY&e=>
>>>>
>>>>                 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).
>>>>
>>>>                 Any ideas what could be going on? I have
>>>>                 experienced this behavior on all 4 Mac's on which I
>>>>                 have tried the software.
>>>>
>>>>                 Thanks,
>>>>                 Kevin Milner
>>>>                 _______________________________________________
>>>>                 Powered by www.kitware.com
>>>>                 <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=Ut0P5Kplo2cIO9V0et1UBQ&m=PGkWSB3OSZwzyAuWZpoUrTh6vHu2mHd7spHGazrOstc&s=bMSpXvNrm0lSJOzozn_AYDBXkpcWuKJqOIhcO2U9yyg&e=>
>>>>
>>>>                 Visit other Kitware open-source projects at
>>>>                 http://www.kitware.com/opensource/opensource.html
>>>>                 <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=Ut0P5Kplo2cIO9V0et1UBQ&m=PGkWSB3OSZwzyAuWZpoUrTh6vHu2mHd7spHGazrOstc&s=puuEFo08Br6VIW-jlXbB2NrI0NJURbszNJqXQ-UwRfM&e=>
>>>>
>>>>                 Please keep messages on-topic and check the VTK FAQ
>>>>                 at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>                 <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=Ut0P5Kplo2cIO9V0et1UBQ&m=PGkWSB3OSZwzyAuWZpoUrTh6vHu2mHd7spHGazrOstc&s=Hc-JN_k805uBFV8S-TRyFDHuUk3CHrXUpjl0jkl-III&e=>
>>>>
>>>>                 Search the list archives at:
>>>>                 http://markmail.org/search/?q=vtkusers
>>>>                 <https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=Ut0P5Kplo2cIO9V0et1UBQ&m=PGkWSB3OSZwzyAuWZpoUrTh6vHu2mHd7spHGazrOstc&s=avoi9QTUdibmomOnfKDIzKnsxhhgi_6aGezMOsU5sxg&e=>
>>>>
>>>>                 Follow this link to subscribe/unsubscribe:
>>>>                 http://public.kitware.com/mailman/listinfo/vtkusers
>>>>                 <https://urldefense.proofpoint.com/v2/url?u=http-3A__public.kitware.com_mailman_listinfo_vtkusers&d=DwMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=Ut0P5Kplo2cIO9V0et1UBQ&m=PGkWSB3OSZwzyAuWZpoUrTh6vHu2mHd7spHGazrOstc&s=jqHgE2FZMbPie2ZrXUZmovFaZhOLkt9s1njUN1kKKg4&e=>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170203/aa642455/attachment-0001.html>


More information about the vtkusers mailing list