WebGL

Google released a new Chrome version that, amongst other things, has support for the new 3D browser standard called WebGL. This is based on OpenGL ES 2.0 which can be found in many android phones.

An example here.



So, the logical question;

Are there plans for JME to support WebGL in the future?

Maybe in the very distant future when WebGL actually becomes more mature and you can do the kind of stuff with it you can do in jME :wink: I don’t believe in this “standard” yet, really.

Hm time to reopen this ^^
As all mayor browsers now support webgl

What i would be intrested to know/ determine, what is missing in webgl that jme relies on? What could be worked around,w here are protention problems.

(Note the idea here is to compile jme3 with the webgl renderer via gwt to a javascript application)

Well first you may have issue with gwt because it only support a subset of the jdk. On the top of my head what’s not supported is reflection and Calendar (which shouldn’t be a problem for JME) but idk if java.nio is supported…
I guess webgl uses raw arrays instead of direct buffers, so that would require some important changes in the core.
Never looked into it to be honest.
I’ve read that webgl is very close to opengles2.0, and you have to use an HTML canvas to draw into it, so it would be a lot like the android harness with the glview.

1 Like

I’d wait for the browser native stuff to merge with webgl and then just use cross compilation to native code / gl directly. No need to mess with thehighlevel WebGL stuffs, thats for web developers or complete adopters of WebGL.

1 Like

I think WebGL is taking off now, just for fun, here are some links that I think show the state of WebGL

Goo technologies have a nice engine (I’m a bit partial since I know a few of the guys working there): http://www.gooengine.com/demos
Someone cross-compiled Unigine to JavaScript/WebGL: http://unigine.com/news/2013/02/20/crypt-in-browser
Turbulenze was recently open sourced: GitHub - turbulenz/turbulenz_engine: Turbulenz is a modular 3D and 2D game framework for making HTML5 powered games for browsers, desktops and mobile devices.
Iñigo Quílez has some cool shaders + source at: https://www.shadertoy.com/
LibGDX cross-compile to webGL using GWT.

But from what I have seen none of these have such a slick environment as the jME SDK :slight_smile: The WebGL rendering engines are there but are lacking the tools.

Edit: I spelled Unigine wrong, fixed now.

But from what I have seen none of these have such a slick environment as the jME SDK :) The WebGL rendering engines are there but are lacking the tools.

Well now unreal engine runs on WebGL. http://www.unrealengine.com/html5/

I tried the Unreal demo and it worked very well.

@Vortex said: I tried the Unreal demo and it worked very well.
I tried it just now, it said browser unsupported (I am using chrome), then I clicked try anyway and it crashed. Instead it proposed downloading a beta version of a browser (firefox nightly). I don't see how this is different than the state of WebGL a few years ago.
1 Like

Same for me, but the other examples works, also sketchfab is using webgl and it works pretty good on chrome.

1 Like

The unreal demo works flawlessly in the latest stable firefox (20) on OS X for me.

I already wrote a very long and detailed article about WebGL some months ago and the situation hasn’t evolved a lot. Moreover, Microsoft has a stragegy for standards and cross-platform technologies:

  • ignore them, impose your own technologies by any means, drive the development for your platform time-consuming so that cross-platform development becomes too expensive
  • if you can’t ignore them, disparage them
  • if you can’t disparage them but if there is no hurry to support them, support them when they become a lot less interesting (for example SVG)
  • if you can’t disparage them but if there is an hurry to support them, support them badly in a way that discredits them but that doesn’t discredit yourself (for example Java)

WebGL is not mature enough yet, maybe it will become really interesting in between 2 and 10 years when it is a bit more reliable.

<cite>@Momoko_Fan said:</cite> I tried it just now, it said browser unsupported (I am using chrome), then I clicked try anyway and it crashed. Instead it proposed downloading a beta version of a browser (firefox nightly). I don't see how this is different than the state of WebGL a few years ago.

What makes this a big deal isn’t really as much about web gl as much as it is the asm.js engine that Firefox added to their browser. That combined with other projects such as emscripten has made web gl not only easy to target but also gives you much faster execution of javascript which is a huge improvement. I had the same browser crash happen when I tried to use chrome too which makes for a pretty bad demo, but really the output of this should run cross browser since asm.js is supposed to be a subset of javascript but you should see a significant performance improvement on the firefox nightly that implements asm.js. I think they still have a ways to go but the demo shows a pretty significant step forward if you want to target the web.

That being said… when I read up on the tech a few months ago it sounded like you couldn’t get nearly the same performance gain when you compiled from Java as opposed to C++. I’m not sure if that is still an issue or not. Either way its not worth the dev time right now when there are other platforms that are much better defined that you could go after.

Well to be honest it’s tempting to at least try…
I have a pretty good knowledge of GWT, and there are existing wrappers over webgl for gwt…it could be to reimplement a renderer (that wouldn’t be that different from the opengles renderer) and some classes that are also redefined for android…
idk.

1 Like
<cite>@nehon said:</cite> Well to be honest it's tempting to at least try.... I have a pretty good knowledge of GWT, and there are existing wrappers over webgl for gwt....it could be to reimplement a renderer (that wouldn't be that different from the opengles renderer) and some classes that are also redefined for android.... idk.
You should contact this guy, he uses WebGL with JOGL and GWT. The JOGL backend already supports OpenGL-ES 2 :)
<cite>@nehon said:</cite> Well to be honest it's tempting to at least try.... I have a pretty good knowledge of GWT, and there are existing wrappers over webgl for gwt....it could be to reimplement a renderer (that wouldn't be that different from the opengles renderer) and some classes that are also redefined for android.... idk.

Well google announced they are integrating asm.js into chrome. If they move gwt to compile to asm.js that would work pretty well :slight_smile:

<cite>@glh3586 said:</cite> Well google announced they are integrating asm.js into chrome. If they move gwt to compile to asm.js that would work pretty well :)
It would improve the performance but it wouldn't improve the reliability of WebGL. I understand that some developers would like to give it a try but it is not yet a viable solution.
<cite>@gouessej said:</cite> It would improve the performance but it wouldn't improve the reliability of WebGL. I understand that some developers would like to give it a try but it is not yet a viable solution.

I’m curious… what kind of reliability problems are you talking about? Most of the problems i’ve run into or read about have been about speed.

Yes, if you dont go all features like the unreal demo, its quite reliable currently from my impression.

Awesome WebGL demo