[vtkusers] new vtkPanel
Jeff Lee
jeff at cdnorthamerica.com
Tue Mar 5 11:14:14 EST 2002
Hi All,
I was going to wait to make an announcement, but in light of the recent
questions about vtkPanel I decided to respond in a blanket manner.
Basically there have been many changes to the way vtkPanel works from
version 3 to version 4.x. First of all, the panel now uses JAWT to
allow vtk to draw into a java Canvas - this used to use
X11DrawingSurfaceInfo(deprecated as of jdk1.3) to obtain a window handle
to pass into vtk to initialize vtkRenderWindow. Other changes include
the addition of Lock() and UnLock() as native methods which can be
called from java. These methods are provided to wrap calls which might
change the awt drawing surface (things like Render() and MakeCurrent()
from native code). For example, methods like
vtkCamera::ResetCameraClippingRange() call
vtkRenderWindow::MakeCurrent(). A method like this needs to be wrapped
with a Lock()/UnLock() block to ensure only one thread at a time
accesses the drawing surface during that time when the drawing surface
is changing (basically acting as a mutex lock). Other methods like
vtkPanel.HardCopy() use this technique to allow vtkWindowToImageFilter
to do a tile render to construct a high-resolution image. These changes
are available in the latest cvs version of vtk - I don't think they
exist on the vtk cdrom in the version 4.0 release. These changes were
made to vtkPanel and vtkJavaAwt.h and hopefully alleviate XLib async
errors that have been so prevalent lately. I have been using it with
redhat7.2, sun, suse, win2k and all seems fine.
-Jeff
Gopalakrishnan, Gowri wrote:
>i am using windows 2000, and vtk3.2. If you run the *.java from command line
>everything is fine. But if you are using a windows IDE then it will be a
>problem. I have seen a lot of posting on this issue In public user groups
>(not connected with vtk, but related to JNI)
>Since this runs from command prompt with out problem it is not a java/native
>interface problem. It is some IDE problem. So I don't mind....
>
>Gowri
>
>
>-----Original Message-----
>From: Jeff Lee [mailto:jeff at cdnorthamerica.com]
>Sent: 05 March 2002 15:42
>To: anast.jm at pg.com
>Cc: vtkusers at public.kitware.com
>Subject: Re: [vtkusers] Swing Based vtkPanel
>
>It works fine for me - on win2000, SunOS, linux. I have never heard of
>this problem before on win2k systems. What are your details - os, vtk
>version, etc... I added the lock/unlock mechanism to allow native code
>to call render/makeCurrent/other calls which affect the drawing surface.
>-Jeff
>
>anast.jm at pg.com wrote:
>
>>Satheesh....I'm not even getting that far with SimpleVTK......the window
>>
>and
>
>>button display okay but even if I do nothing the app crashes in 1
>>
>sec...just too
>
>>new to figure this out on my own...john
>>
>>An unexpected exception has been detected in native code outside the VM.
>>Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77f67616
>>Function name=RtlLeaveCriticalSection
>>Library=C:\WINNT\System32\ntdll.dll
>>
>>Current Java thread:
>> at vtkPanel.UnLock(Native Method)
>> at vtkPanel.Render(vtkpanel.java:82)
>> at vtkPanel.paint(vtkpanel.java:90)
>> at sun.awt.RepaintArea.paint(Unknown Source)
>> at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
>> at java.awt.Component.dispatchEventImpl(Unknown Source)
>> at java.awt.Component.dispatchEvent(Unknown Source)
>> at java.awt.EventQueue.dispatchEvent(Unknown Source)
>> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
>>
>Source)
>
>> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
>>
>Source)
>
>> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>> at java.awt.EventDispatchThread.run(Unknown Source)
>>
>>
>>
>>Internet Mail Message
>>Received from host: public.kitware.com
>>[208.136.18.25]
>>
>>
>>
>>From: Satheesh Maheswaran
>>
><s.maheswaran at eastman.ucl.ac.uk>@public.kitware.com on
>
>>03/05/2002 03:23 PM GMT
>>
>
>> Satheesh Maheswaran To:
>>
>"Gopalakrishnan, Gowri"
>
>><s.maheswaran at eastman.ucl.ac.uk>@public.kitware.com
>>
><Gowri.Gopalakrishnan at inteq.com>
>
>> Cc:
>>
>"'da5y-ngmn at asahi-net.or.jp'"
>
><da5y-ngmn at asahi-net.or.jp>,
>
>> Sent by: vtkusers-admin at public.kitware.com
>>
>vtkusers at public.kitware.com (bcc: John
>
>> 03/05/2002 10:23 AM Anast-JM/PGI)
>>
>
>> Subject: Re:
>>
>[vtkusers] Swing Based vtkPanel
>
>
>
>>
>>
>>
>>hello users
>>
>>I am trying to get vtkPanel.java work with SimpleVTK.java given with VTK.
>>
>Its in
>
>>vtk/wrapping/java
>>
>>All works, and the panel gets displayed with cone and an exit button. Here
>>
>awt
>
>>and swing
>>components are mixed, and the vtkPanel.java extends Canvas, which I think
>>
>is
>
>>awt.
>>
>>So when i run it and try to interact with it, all key events work and the
>>
>exit
>
>>button work,
>>but when trying the mouse events. like zooming, it crashes :)
>>
>>has anyone come across the same problem !!! or may be even a solution for
>>
>the
>
>>problem !!
>>
>>satheesh
>>
>>"Gopalakrishnan, Gowri" wrote:
>>
>>>If you look in the sun's web site on JNI (java native interface) and the
>>>native code for vtkPanel.java you will see that they are quite identical.
>>>It used to be that you could grab drawing surface information and the
>>>
>window
>
>>>handle only from canvas (it is a undocumented codes in jdk). But I have
>>>
>come
>
>>>across something similar in Swing. In vtk 3.2 it is done using canvas, but
>>>in vtk4.0 I do not know. You cannot use anything else other than canvas
>>>
>(now
>
>>>a swing component - I forgot which )to get this information from sun's
>>>
>jdk.
>
>>>Also with your swing problem - even if you got it to work now you might
>>>
>end
>
>>>up with strange behaviours in swing components when they are put on the
>>>
>awt
>
>>>component. Event handling especially can be troublesome. If you have not
>>>done too much dev. already it is a good/wise idea to change to completely
>>>swing. Mixing awt and swing leads to frustration.
>>>
>>>Gowri
>>>
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: <
>>>
>>http://public.kitware.com/cgi-bin/vtkfaq>
>>
>>>Follow this link to subscribe/unsubscribe:
>>>http://public.kitware.com/mailman/listinfo/vtkusers
>>>
>>_______________________________________________
>>This is the private VTK discussion list.
>>Please keep messages on-topic. Check the FAQ at: <
>>http://public.kitware.com/cgi-bin/vtkfaq>
>>Follow this link to subscribe/unsubscribe:
>>http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>>
>>_______________________________________________
>>This is the private VTK discussion list.
>>Please keep messages on-topic. Check the FAQ at:
>>
><http://public.kitware.com/cgi-bin/vtkfaq>
>
>>Follow this link to subscribe/unsubscribe:
>>http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list