I found an interesting component which is Eclipse SWT Browser. It is a binding to Webkit but didn't know how to enable WebGL in it.
One easy way is using SWT.MOZILLA, but on Linux there is a compatibility problem between GTK3 and XULRUNNER.
So I was wondering if I can set the browser mode to SWT.WEBKIT (which is done) and then access somehow to webkit settings page and set the property "enable-webgl" to true (but I didn't know how).
Thanks.
This is fixed in latest build of SWT and will be available with 4.7/Oxygen M5. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=510082
Have your system render the following HTML ... a simple test which will attempt to obtain a WebGL context ... the make or break test whether a brower handles WebGL ... you will see a popup saying WebGL either works or fails :
I think this might help :
[details here] (Enable WebGL in the Mac OS application on WebKit)
I had the same problem and the following worked for me. The issue is that the SWT does not enable webgl in webkit. To make this happen you need to change some code in SWT and rebuild.
Create build environment. I work on a Mac so I used VirtualBox to create a Ubuntu virtual machine (or use a linux machine). Make sure you install a JAVA JDK as this is required to compile the native interface code. You will also need eclipse. I then followed these instructions to setup the SWT build environment (https://www.eclipse.org/swt/faq.php#howbuildjar). I imported the org.eclipse.swt and the org.eclipse.swt.gtk.linux projects into eclipse. I was building for 32bit linux with GTK (select the appropriate build for your needs as per SWT instructions). Then build by right-click on build.xml in the org.eclipse.swt.gtk.linux project and select "Run as"-->"Ant build...". This will popup a dialog and you select the "build.jars" target and click the RUN button.
Assuming all goes well you should get output like this.
The line above the BUILD SUCCESSFUL gives you the location of the swt.jar. This build will also create the libswt*.so files if you need to install them on the target system.
Modify code. Now that we can build a swt.jar we need to modify the code. I have modified 2 java files to enable the webgl in webkit. The first file is org.eclipse.swt.internal.webkit.WebKitGTK.java. Look for the following block of code and add a definition for enable_webgl as shown.
The next file is org.eclipse.swt.browser.WebKit.java. Look for the create method and the code that changes setting in the web view. I have added a call to enable the webgl as shown.
Building again. Once you have made these changes and saved them you can rebuild. Simply run the "Build.jars" target again to create a new swt.jar.
Testing. I created a sample swt browser using code from the SWT examples. Then deployed my new swt.jar and the libswt*.so to the target machine. As a test I just tried some of the many samples on the web. Lastly you may need to set the following environment variables to enable GTK3 and WEBKIT2.
I have tested this on nvidia and intel based PC running gentoo.