<div dir="ltr">Hi all,<div><br></div><div>I've just made the same test with vtkJoglCanvasComponent on Linux (Arch Linux 64-bit, Java 7u21 64-bit, Macbook Pro i5 with NVIDIA native video drivers), and I obtained the same exact behavior as on Mac OS X (described in my previous post): in summary everything works quite fine, but the JVM crashes as soon as I mouse-press or drag over the widget itself.</div>
<div><br></div><div>Here is the crash dump I obtained on Linux, which is maybe even more useful than the previous one:</div><div><br></div><div>===================</div><div>[...]</div><div><div>Stack: [0x00007fcecd37e000,0x00007fcecd47f000], sp=0x00007fcecd47b6e0, free space=1013k</div>
<div>Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)</div><div>C [<a href="http://libvtkRenderingOpenGL-6.1.so">libvtkRenderingOpenGL-6.1.so</a>+0x113817] vtkUpload3D<unsigned char>::Upload(void*, unsigned char*, unsigned int*, int, long long*, int, int*)+0x69</div>
<div><br></div><div>Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)</div><div>j vtk.vtkRenderWindowInteractor.LeftButtonPressEvent_109()V+0</div><div>j vtk.vtkRenderWindowInteractor.LeftButtonPressEvent()V+1</div>
<div>j vtk.rendering.vtkInteractorForwarder.mousePressed(Ljava/awt/event/MouseEvent;)V+227</div><div>j java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V+54</div><div>j java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V+81</div>
<div>j java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V+581</div><div>j java.awt.Component.dispatchEvent(Ljava/awt/AWTEvent;)V+2</div><div>j java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+41</div>
<div>j java.awt.EventQueue.access$200(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V+3</div><div>j java.awt.EventQueue$3.run()Ljava/lang/Void;+12</div><div>j java.awt.EventQueue$3.run()Ljava/lang/Object;+1</div>
<div>v ~StubRoutines::call_stub</div><div>J java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;</div><div>j java.security.ProtectionDomain$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28</div>
<div>j java.security.ProtectionDomain$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+6</div><div>j java.awt.EventQueue$4.run()Ljava/lang/Void;+11</div><div>
j java.awt.EventQueue$4.run()Ljava/lang/Object;+1</div><div>v ~StubRoutines::call_stub</div><div>J java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;</div>
<div>J java.awt.EventDispatchThread.pumpOneEventForFilters(I)V</div><div>j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35</div><div>j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11</div>
<div>j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4</div><div>j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3</div><div>j java.awt.EventDispatchThread.run()V+9</div><div>v ~StubRoutines::call_stub</div>
<div><br></div></div><div><div class="gmail_extra">[...]</div><div class="gmail_extra">===================<br><br>I am looking forward to hearing your comments.</div><div class="gmail_extra">Thanks in advance and best regards,</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Marco Sambin</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 11, 2013 at 4:34 PM, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Seb,<div><br></div><div>thanks for your feedback.</div>
<div><br></div><div>I've just tested on Mac (Mac OS X 10.8.4, Java 7u25, Macbook Pro i5), and here is what happens:</div><div><br></div><div>- I am able to correctly display the 3D scene with the 3 vtkImagePlaneWidgets (for the first time on VTK + Mac OS X + Java 7, and that's good! :-)).</div>
<div><br></div><div>- I am able to interact with the 3D scene (i.e., move/rotate the camera) when dragging my mouse on the 3D scene OUTSIDE the vtkImagePlaneWidgets.</div><div><br></div><div>- If I press or drag with the mouse INSIDE the vtkImagePlaneWidgets, then the JVM crashes. Here is a relevant (I hope) fragment of the JVM crash dump:</div>
<div><br></div><div>=================</div><div>[...]</div><div><br></div><div><div>Stack: [0x000000013d09c000,0x000000013d19c000], sp=0x000000013d197fa0, free space=1007k</div><div>Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)</div>
<div>C [libvtkRenderingOpenGL-6.1.1.dylib+0x857b7] _ZN11vtkUpload3DIhE6UploadEPvPhPjiPxiPi+0xd5</div>
<div>C [libvtkRenderingOpenGL-6.1.1.dylib+0x81834] _ZN20vtkPixelBufferObject8Upload3DEiPvPjiPxiPi+0x9a8</div><div>C [libvtkRenderingOpenGL-6.1.1.dylib+0x7a085] _ZN16vtkOpenGLTexture4LoadEP11vtkRenderer+0x1a7d</div><div>
C [libvtkRenderingFreeType-6.1.1.dylib+0x1b8c6] _ZN12vtkTextActor13RenderOverlayEP11vtkViewport+0x5a</div><div>C [libvtkRenderingCore-6.1.1.dylib+0x7bd38] _ZN11vtkRenderer14UpdateGeometryEv+0x114</div><div>C [libvtkRenderingOpenGL-6.1.1.dylib+0x6a3aa] _ZN17vtkOpenGLRenderer12DeviceRenderEv+0xea</div>
<div>C [libvtkRenderingCore-6.1.1.dylib+0x7b5c1] _ZN11vtkRenderer6RenderEv+0x26f</div><div>C [libvtkRenderingCore-6.1.1.dylib+0x7aacc] _ZN21vtkRendererCollection6RenderEv+0x5a</div><div>C [libvtkRenderingCore-6.1.1.dylib+0x824c3] _ZN15vtkRenderWindow14DoStereoRenderEv+0x83</div>
<div>C [libvtkRenderingCore-6.1.1.dylib+0x8241b] _ZN15vtkRenderWindow10DoFDRenderEv+0x38d</div><div>C [libvtkRenderingCore-6.1.1.dylib+0x8206a] _ZN15vtkRenderWindow10DoAARenderEv+0x43a</div><div>C [libvtkRenderingCore-6.1.1.dylib+0x81905] _ZN15vtkRenderWindow6RenderEv+0x149</div>
<div>C [libvtkRenderingCore-6.1.1.dylib+0x85673] _ZN25vtkRenderWindowInteractor6RenderEv+0x27</div><div>C [libvtkCommonCore-6.1.1.dylib+0x59561] _ZN18vtkCallbackCommand7ExecuteEP9vtkObjectmPv+0x21</div><div>C [libvtkCommonCore-6.1.1.dylib+0xb60bc] _ZN16vtkSubjectHelper11InvokeEventEmPvP9vtkObject+0x39a</div>
<div>j vtk.vtkRenderWindowInteractor.LeftButtonPressEvent_109()V+0</div><div>j vtk.vtkRenderWindowInteractor.LeftButtonPressEvent()V+1</div><div>j vtk.rendering.vtkInteractorForwarder.mousePressed(Ljava/awt/event/MouseEvent;)V+227</div>
<div>j java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V+54</div><div>j java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V+81</div><div>j java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V+581</div>
<div><br></div><div>Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)</div><div>j vtk.vtkRenderWindowInteractor.LeftButtonPressEvent_109()V+0</div><div>j vtk.vtkRenderWindowInteractor.LeftButtonPressEvent()V+1</div>
<div>j vtk.rendering.vtkInteractorForwarder.mousePressed(Ljava/awt/event/MouseEvent;)V+227</div><div>j java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V+54</div><div>j java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V+81</div>
<div>j java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V+581</div><div>J java.awt.EventQueue.access$200(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V</div><div>J java.awt.EventQueue$3.run()Ljava/lang/Object;</div>
<div>v ~StubRoutines::call_stub</div><div>J java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;</div><div>J java.security.ProtectionDomain$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;</div>
<div>j java.security.ProtectionDomain$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+6</div><div>j java.awt.EventQueue$4.run()Ljava/lang/Void;+11</div>
<div>
j java.awt.EventQueue$4.run()Ljava/lang/Object;+1</div><div>v ~StubRoutines::call_stub</div><div>J java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;</div>
<div>J java.security.ProtectionDomain$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;</div><div>j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+73</div>
<div>j java.awt.EventDispatchThread.pumpOneEventForFilters(I)V+245</div><div>j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35</div><div>j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11</div>
<div>j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4</div><div>j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3</div><div>j java.awt.EventDispatchThread.run()V+9</div><div>v ~StubRoutines::call_stub</div>
<div><br></div><div>[...]<br></div><div>=================<br></div><div><br></div><div>Please let me know if this tells you something useful, and if I can be of further help.</div><div><br></div><div>I will now make some tests on Linux as well, and will report back to you.</div>
<div><br></div><div>Thanks and best regards,</div><div><br></div><div>Marco Sambin</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 11, 2013 at 6:10 AM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Marco,<div><br></div><div>You may have found an issue that I missed on Windows. For some reason the event forwarding to the interactor was freezing the application. Therefore, I took the same route as the old vtkPanel by using a direct camera manipulation (as an option for windows app).</div>
<div>Unfortunately 3d widget do expect interactor events. Therefore, to properly work, we will have to figure out how to properly solve the issue that you discovered.</div><div><br></div><div>Do you mind testing that on Mac and letting me know if the issue exist?</div>
<div><br></div><div>Moreover, I should make a proper announcement to the mailing list but I've merged into master a couple days ago a branch that let CMake do a proper packaging of VTK for Java if the proper options are provided.</div>
<div><br></div><div>Seb</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 1:06 PM, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Seb,<div><br></div><div>thanks for your feedback.</div>
<div><br></div><div>The example was indeed useful: I am now using vtkJoglCanvasComponent (got current VTK 6.1 from GIT) as my rendering component, and now I am rendering my 3D view through JOGL, after loading a bunch of JARs and native libs.</div>
<div><br></div><div>Rendering seems to work quite fine on Windows (I am testing on this OS first of all, then I will move to Mac later), and I can see my 3 vtkImagePlaneWidgets in the 3D view. Also, if I programmatically change vtkImagePlaneWidgets' plane positions or orientations, and then call Render() on my vtkJoglCanvasComponent, the 3D view is updating fine.</div>
<div><br></div><div>On the other side, if I try to interact with the widgets in the 3D view through the mouse, my Java application immediately and completely freezes, and the CPU goes up to 25%.</div><div><br></div><div>
Can you guess what is causing this behavior? Is interaction with widgets supposed to work when using JOGL?</div>
<div><br></div><div>I have not tested this, but I have the impression that the application freezes when the widget's native code calls "this->Interactor->Render();". Will this call be somehow "intercepted" by JOGL, and become equivalent to calling Render() on the vtkJoglCanvasComponent (which, on the other side, seems to work fine)?</div>
<div><br></div><div>Thanks again for your feedback: this path seems really promising, and may open a whole new world with using VTK from Java.</div><div><br></div><div>Regards,</div><div><br></div><div>Marco</div><div><br>
</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 9, 2013 at 5:33 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Marco, <div><br></div><div>you will have to use another class. But you will have the same integration capability.</div>
<div><br></div><div>Look at src/VTK/Wrapping/Java/vtk/sample/rendering/JoglConeRendering.java for more details.</div>
<div><br></div><div>Seb</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 9, 2013 at 10:37 AM, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Seb,<div><br></div><div>this is great news, and I will give it a try!</div>
<div>One question: will I be able to keep using vtkCanvas as a Java panel class, or rather shall I move to something different?</div>
<div>Thanks again for your feedback.</div><div><br></div><div>Best regards,</div><div><br></div><div>Marco Sambin</div><div><br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Sep 9, 2013 at 2:45 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Marco,<div><br></div><div>you won't be able to rely on offscreen rendering on Mac to properly handle the issue you are trying to overcome.</div>
<div><br></div><div>Although, a couple of weeks ago, I've pushed a new set of classes that works on Mac OS X and Java7 (and on the other of the platforms).</div>
<div>Those classes rely on JOGL to do the rendering. So if adding JOGL as a dependency is not an issue, you can directly use those.</div><div><br></div><div>For that you will need to get VTK/master from git and when you build VTK, you will have to turn ON that component. Moreover if you already download JOGL/GLUGEN using maven, CMake should find the appropriate jars for you.</div>
<div>Otherwise you will need to specify their paths.</div><div><br></div><div>Here is the dependency for Maven.</div><div><br></div><div><div>+ <dependency></div><div>+ <groupId>org.jogamp.jogl</groupId></div>
<div>+ <artifactId>jogl-all-main</artifactId></div><div>+ <version>2.0.2</version></div><div>+ </dependency></div><div>+ <dependency></div>
<div>+ <groupId>org.jogamp.gluegen</groupId></div><div>+ <artifactId>gluegen-rt-main</artifactId></div><div>+ <version>2.0.2</version></div>
<div>+ </dependency></div><div><br></div><div>Hope that could help you,</div><div><br></div><div>Seb</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Sep 9, 2013 at 7:22 AM, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">Dear VTKers,<div><br></div><div>I am developing a VTK 6-based Java application, and I am making some efforts to make it compatible with Mac OS X as well.</div><div><br></div><div>I know that the jawt embedding currently supported by Java 7 on Mac (which is CALayer-based) does not work with VTK 6 (nor with previous VTK versions), but there are several portions of my application which do not use direct drawing by VTK classes to Java panels (i.e., do not use jawt), hence will work fine on Mac + Java 7 as well.</div>
<div><br></div><div>Now, for the portions of my application where VTK classes need to actually "draw", my question is: will offscreen rendering work on Mac? The basic idea would be to grab the output of the offscreen rendering, convert it to a Java-compatible image, and draw it to a Java panel. I know this will be a significant performance penalty, but my requirements in this moment are not so strict or demanding under this point of view.</div>
<div><br></div><div>In particular, I have a vtkCanvas-derived panel, where I display some planes in 3D (actually, they are vtkImagePlaneWidgets, but I am mainly interested in the "display" functionality, not in the interactivity of the widget with the user). Will it be sufficient to call myVtkCanvas.GetRenderWindow().SetOffScreenRendering(1) to obtain offscreen rendering on my Mac? Or it is more complicated than that?</div>
<div><br></div><div>Currently, calling just myVtkCanvas.GetRenderWindow().SetOffScreenRendering(1), I am obtaining a crash in the OpenGL library when running my application on the Mac.</div><div><br></div><div>Thanks in advance for your feedback.</div>
<div><br></div><div>Best regards,</div><div><br></div><div>Marco</div><div><br></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>