[vtkusers] No direct rendering under Linux (X11) with SWT (Java)

Song Ho Ahn song.ahn at sheridanc.on.ca
Wed Jul 27 11:23:20 EDT 2005

Hi Christopher,
Enabling DRI (direct rendering) is for system wise, not application 

Please make sure that direct rendering is enabled on your system using 
"glxinfo" command.

If it is not loaded, you need to get a proper driver and kernel module 
for your video card. And you must load "dri" in your Xorg.conf file.
The hardware acceleration on Linux system is somewhat tricky compared to 
on MS windows, but it is not much difficult as compiling VTK.

Christopher Auer wrote:

>Hello everyone,
>we are currently developing a VTK application under Java using the
>"standard widget toolkit" (SWT - also known from the eclipse project
>http://www.eclipse.org). We developed our own SWT widget to display VTK
>data sets. It works just like the vtkPanel and the vtkCanvas included in
>the VTK package. We would also contribute the code to the community if
>you are interested!
>A few words to SWT: SWT uses the native GUI library of the operating
>system. Under Linux (X11) this is GTK2 (should also work with Motif) and
>under Windows this is MFC. SWT stores the operating system dependent
>handles in members of the SWT classes. In our implementations this
>handles are simply passed to the VTK RenderWindow class (SetDisplayId
>and SetWindowId): The window id is the X-handle of the widget and the
>display id the current X-display handle. This works very  fine with VTK:
>The content of the vtkRenderWindow is displayed and the events are also
>fired properly.
>The only problem we have is that no direct rendering is active (the
>method IsDirect returns false). This are the things we tried out to fix
>the problem (obviously with no solution):
>- we deactivated the stereo option in the RenderWindow
>- we set "multi sampling" to 0 in the RenderWindow
>- we created our own gl context using the current displa
>(XOpenDisplay( NULL ) ) in the shared object library where our
>JNI-RenderCreate call is located: glXIsDirect returns true with STEREO
>and MULTISAMPLING disabled
>At first we worked with the vtkPanel/vtkCanvas classes: To get them
>running we had to use a SWT_AWT bridge class. The bridge class returns a
>AWT-frame for the passed SWT-Composite (a widget container). In the
>AWT-frame you can place the vtkPanel/vtkCanvas. This only partly works,
>because SWT and AWT run in different dispatch threads (we always had a
>lot of concurrency problems). So we decided to make our own
>One thing we found out is that whether direct rendering is available or
>not is decided only on the properties of the X11-display and the options
>of the glXChooseVisual-call. The properties of the window/widget are not
>Thanks in advance for any helping hand!
>Christopher Auer

Song Ho Ahn                   song.ahn at sheridanc.on.ca
Visualization Researcher/Developer
Visualization Design Institute        Sheridan College
Tel: 905.845.9430 ext 8703         1430 Trafalgar Road
Fax: 905.815.4220                Oakville, ON, L6H 2L1

More information about the vtkusers mailing list