[vtkusers] No direct rendering under Linux (X11) with SWT (Java) (now with more information)
Christopher Auer
christopher.auer at web.de
Mon Aug 1 06:10:49 EDT 2005
Hello again everyone,
Last week I wrote you about our problem with SWT and Java: We are unable
to get a GL-context with direct rendering enabled when using SWT (bound
to GTK2) and VTK (please find below the original email). Unfortunately
we still have not found any solution for this problem. So I am asking
again for help with a bit more specific information on the problem.
SWT internally maps the calls to GTK2 handles. Our VTK-SWT-Panel uses a
GTK-socket which is mapped to a XEMBED handle. Is anyone out there who
uses VTK with GTK2, GTK-sockets or XEMBED with a similar problem (no
DRI)? We also have the problem that GTK spits out a lot of Gtk-Warnings
when wea are using our SWT-VTK-Panel:
Gtk-WARNING **: GtkSocket: Invalid _XEMBED message of type 4 received
This message (with various message types) occurs everytime the window
(panel) gains or loses the focus. Currently we do the following in our
RenderCreate function (called by the Java-Class via JNI):
renderWindow->SetParentId( windowId )
where windowId the XWindow-handle of the panel. The messages disappear
with
renderwindwows->SetWindowid( windowId )
but then the program crashes when destroying and re-creating the
SWT-VTK-panel.
I should also mention that DRI generally works on the machine (glxinfo
says: "direct rendering = yes").
Thanks in advance!
Christopher
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