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

Christopher Auer christopher.auer at web.de
Wed Jul 27 18:09:30 EDT 2005

At first we used a "SWT-AWT"-bridge to display AWT widgets in our SWT
application (the VTK-Java widget is based on AWT). This widget was able
to use direct rendering - our own SWT widget is not able to do so...

I also did some experiments by creating my own GL context in a native
library (C/C++) called by my Java class (via JNI - Java Native
Interface). In this library direct rendering is available (as I stated
before with stereo and multisampling disabled). I copied the code to
create the GL context from the vtkRenderWindow.cxx file (just to be sure
to do absolutely the same as the vtk-developers do). So my own code
(using the same options as the vtk-class) is able to get DRI activated,
but the vtk-class is not - all in the same Java process!

So DRI is available, but for some reasons the vtkRenderWindow class
defines some options which prevents DRI from being activated *sigh*



On Wed, 2005-07-27 at 15:20 -0400, Song Ho Ahn wrote:
> Christopher,
> Then, is it related with Java?
> Have you run any VTK examples written with C++ or Tcl/Tk? Are they 
> running accelerated?
> As you know, there are various modes that OpenGL can support. I am not 
> sure that Java cannot enable a accelerated modes because of its nature 
> (running on VM).
> (I don't have any experience with Java plus VTK.)
> ==song==
> Christopher Auer wrote:
> >Hi Song,
> >
> >thanks, but as I stated in my mail: When I create my own GLX context
> >with stereo and multisampling disabled, I get direct rendering activated
> >- but VTK - later on - does not... :( BTW: glxinfo gives me direct
> >rendering = yes (that was the first thing I checked...). The problem
> >also occurs on other machines where DRI is definitely running!
> >
> >Thanks
> >
> >
> >Christopher
> >
> >On Wed, 2005-07-27 at 11:23 -0400, Song Ho Ahn wrote:
> >  
> >
> >>Hi Christopher,
> >>Enabling DRI (direct rendering) is for system wise, not application 
> >>specific.
> >>
> >>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.
> >>==song==
> >>
> >>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
> >>>SWT-VTK-widget.
> >>>
> >>>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
> >>>important.
> >>>
> >>>Thanks in advance for any helping hand!
> >>>
> >>>
> >>>Christopher Auer
> >>> 
> >>>
> >>>      
> >>>
> >>    
> >>

Christopher Auer <christopher.auer at web.de>

More information about the vtkusers mailing list