com.jogamp.opengl.swt.GLCanvas does not work with Eclipse 4.8 under Linux

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

com.jogamp.opengl.swt.GLCanvas does not work with Eclipse 4.8 under Linux

Felix Hirsch
This post was updated on .
Hi,

I am filing a JOGL/SWT problem here since the JOGL bugtracker is still down (http://forum.jogamp.org/JogAmp-bugzilla-down-td4038904.html).

When using com.jogamp.opengl.swt.GLCanvas under Linux with Eclipse 4.8 (SWT 3.107) an Exception is thrown in com.jogamp.nativewindow.swt.SWTAccessor class during initialization.

JOGL tries to access the member field "GTK_VERSION" of SWT's internal OS class via reflection. The class still exists but the member is no more present in SWT 3.107.  I've checked the source code of OS class and it is not there any more but was in SWT 3.105 which comes along with Eclipse 4.6.

To reconstruct the problem one simply has to access a member of SWTAccessor:


    try {
        boolean x11 = SWTAccessor.isX11GTK;
        System.out.println(x11);
    } catch (Throwable e) {
        e.printStackTrace();
    }


The resulting exception is:


    Caused by: java.lang.NoSuchFieldException: GTK_VERSION
     at java.lang.Class.getField(Class.java:1703)
            at com.jogamp.nativewindow.swt.SWTAccessor.<clinit>(SWTAccessor.java:183)
            ... 1 more


Unfortunally SWT's own GLCanvas is currently not usable as well as it has no depth buffer since GTK3.16 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=539220) and therefore JOGL can't be used with Eclipse 4.8 in any way.
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.opengl.swt.GLCanvas does not work with Eclipse 4.8 under Linux

gouessej
Administrator
Hello

The class still exists:
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT%20PI/gtk/org/eclipse/swt/internal/gtk/OS.java

We should use the GTK class in this case:
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/bundles/org.eclipse.swt/Eclipse%20SWT%20PI/gtk/org/eclipse/swt/internal/gtk/OS.java#n96

We should catch the NoSuchFieldException and call GTK.gtk_major_version(), gtk_minor_version() and gtk_micro_version().

If I provide a patch, will you have any time to give it a try?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.opengl.swt.GLCanvas does not work with Eclipse 4.8 under Linux

Felix Hirsch
Yes the class still exists but not the member which SWTAccessor tries to access.

Yes I will test it, if you provide a patch. At best a binary build including the patch so I don't have to build it myself.

Thanks.