JerBear
Posts: 6
Joined: Sun Oct 16, 2016 12:16 am

Does Chromium/Pi support WebGL 2?

Wed Dec 19, 2018 9:21 pm

I'm wanting to play around with WebGL on my Pi. After turning on the experimental GL driver in raspi-config, I went to [url]chrome://gpu[/url] in Chromium and sure enough it said both WebGL and WebGL 2 were supported and hardware-accelerated.
Image

Now it came time to test it out. I opened DevTools and ran:

Code: Select all

document.createElement("canvas").getContext("webgl");
Sure enough, it gave me a WebGL context. I was able to run a few demos (slowly, but still playable).

However, I want support for non-power of 2 textures and GLSL 3, which only come with WebGL 2. If I try my test again:

Code: Select all

document.createElement("canvas").getContext("webgl2");
Now Chromium returns null, even though the GPU page lists it as hardware accelerated.

Looking at glxinfo, I see this:

Code: Select all

OpenGL ES profile version string: OpenGL ES 2.0 Mesa 13.0.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
WebGL 2 is based on OpenGL ES 3 and GLSL ES 3. Does videocore not support WebGL 2? Why would Chromium tell me it does? What's going on here?

Rascas
Posts: 461
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Does Chromium/Pi support WebGL 2?

Wed Dec 19, 2018 11:23 pm

The Raspberry Pi supports OpenGL ES 2.0 at maximum.

User avatar
Gavinmc42
Posts: 3455
Joined: Wed Aug 28, 2013 3:31 am

Re: Does Chromium/Pi support WebGL 2?

Thu Dec 20, 2018 3:16 am

viewtopic.php?f=67&t=229229

As I understand it, WebGL is based on OpenGLES 2.0 and WebGL 2 is based on OpenGLES 3.
I am not sure how well the OpenGL driver supports OpenGLES 3.
The VC4 only has support for OpenGLES 2, so any 3.0 stuff will have to be converted/translated down.

Try it and see, but GLSL 3 etc is new, way newer than the VC4 GPU?
How much can be done in the Arm cores?
Is there a way to do it in software?

Is it coming soon or one day/month/year?
https://anholt.github.io/twivc4/2018/12/10/twiv/
The V3D driver is for the VC5/6 based SoC's, some of it may end up being ported down to the VC4 driver?

Work in progress or usable?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

JerBear
Posts: 6
Joined: Sun Oct 16, 2016 12:16 am

Re: Does Chromium/Pi support WebGL 2?

Thu Dec 20, 2018 10:26 pm

It's looking like VC5 is our best bet with native support for ES 3. Any software rendering would ruin what little performance WebGL currently has. Anholt seems to have been hard at work on it for over a year. Maybe this coming Pi Day we'll have our answer...

User avatar
Gavinmc42
Posts: 3455
Joined: Wed Aug 28, 2013 3:31 am

Re: Does Chromium/Pi support WebGL 2?

Fri Dec 21, 2018 2:49 am

I guess it really depends on the type of playing about you want to do with WebGL.
Learning WebGL up to a xx number of polygons should be ok.

The really fancy current tech stuff like glTF on Vulkan perhaps not.
But could a limited Browser be made from a glTF viewer and glTF server?
Raspbian is massive piece of software, comes with a lot, Chromium is also massive and does a lot.

A Pi could be a server for WebGL 2 files, view them on PC or Smartphone?
Until a few days ago I did not even think about WebGL on Pi's.

So do you want to make WebGL2 content or just view it?

Because I do most of my stuff with Ultibo, Pascal code like Benjamin's is very interesting.
https://github.com/BeRo1985
Could it be done on Pi's?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

JerBear
Posts: 6
Joined: Sun Oct 16, 2016 12:16 am

Re: Does Chromium/Pi support WebGL 2?

Fri Dec 21, 2018 8:15 am

I was hoping to view WebGL 2 content on my Pi but it seems like it's not supported (yet). It's not at all urgent so I'm willing to just drop it for now.

User avatar
Gavinmc42
Posts: 3455
Joined: Wed Aug 28, 2013 3:31 am

Re: Does Chromium/Pi support WebGL 2?

Sun Jul 21, 2019 2:17 am

Not only does the Pi4 do WebGL2 it is not bad with glTF as well
http://github.khronos.org/glTF-Sample-Viewer/
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Graphics, sound and multimedia”