2

I have a web project (depends on WebGL) which works on computers, any browser. Now I am trying this project to be opened as an application on Android based mobile phones. I used WebView to accomplish this. My phone (Nexus 3) had Android 4.3 and as I learnt afterwards before Android 5, WebView component didn't support WebGL. With Android 5, WebView became an updatable independent component which depends on Chromium version 37 (can be updated) and started to support WebGL. So the error I was getting with Android 4.3 is expected.

After this I tried using another phone (Samsung galaxy S4 with Android 5 and Chrome version 43 on it). So then the application should have worked well, but still got error on WebView. I tried get.webgl.org still the same error:

Error constructing CesiumWidget.

Visit http://get.webgl.org to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers.

Detailed error information is below:

RuntimeError: The browser supports WebGL, but initialization failed.

Error

at new RuntimeError (http://192.168.43.125:8090/TMAPW/lib/Cesium/Build/CesiumUnminified/Cesium.js:10657:19)
at new Context (http://192.168.43.125:8090/TMAPW/lib/Cesium/Build/CesiumUnminified/Cesium.js:96489:19)
at new Scene (http://192.168.43.125:8090/TMAPW/lib/Cesium/Build/CesiumUnminified/Cesium.js:120928:23)
at new CesiumWidget (http://192.168.43.125:8090/TMAPW/lib/Cesium/Build/CesiumUnminified/Cesium.js:130986:25)
at AMouseListener.Map2D.initWidget 

This still seemed like a configuration problem, so then I tried to open this on Chrome not on WebView yet still the same error. I enabled WebGL on Chrome following instuctions. `Firefox works fine though. I have three questions:

  1. Does there seem to be anything I am doing wrong, how can I fix it?

  2. Does Android still not support WebGL on WebView, isn't there any possible way to open WebGL dependent applications?

  3. Is there any other way to open a WebGL project as an application. (I have read about cordova and cocoon.js but not sure if it can be accomplished through these.) So if there is one which works fine I'd rather go directly for it.

Peter O.
  • 28,965
  • 14
  • 72
  • 87
halil
  • 750
  • 14
  • 29

3 Answers3

7

Well I wanted to add this as an edit, but it wasn't accepted, so I added my findings as an answer:

I managed to make it work with CrossWalk on any device with Android 4+ on it and android webview with a sony xperia phone with android 5 on it. I wanted to add the things I've found:

If you want to use android webview, your device must have android 5+ and your device must not be on gpu_blacklist. There is no device list for gpu_blacklist on the net that I can find, but there is a way to understand that your device is in the gpu_blacklist or not. Open chrome, then type chrome://gpu, then look at reset notification strategy field. If it is 0x8252 then your device supports webgl, if it is 0x0000 then your device is in the blacklist. So with android 5+ and your device not being on the gpu_blacklist, you can use webgl with android webview.

If you want to use chrome instead of android webview even with a device which is on gpu_blacklist, you must use chrome version 37+. To check it, open chrome, type chrome://version. After that open chrome, type chrome://flags, in that page enable webgl and override software rendering list fields. With that you can use webgl even with devices that on the gpu_blacklist or with devices that has os below android 5 on them.

If your device can't provide above requirements, like mine, you can use CrossWalk it works. However, the documentation is not well organized and you can't find much information other than its own documentation, in case you have problems with it. The reason CrossWalk works is when you build apk file you can send command line arguments like --ignore-gru-blacklist. However as the documentation states if you use this on devices that are on the gpu_blacklist, your application or the whole device might froze.

halil
  • 750
  • 14
  • 29
1

I suggest you try CrossWalk, based on Chromium/blink

https://crosswalk-project.org/documentation/samples/webgl.html

murkle
  • 344
  • 1
  • 7
  • 1
    Thanks for the reply. I managed to make this work on Chrome by enabling --ignore-gpu-blacklist, but couldn't find anywhere to enable the same switch for webview(even though android 5's webview is based on chrome). I guess my device graphics card is in the blacklist. I started reading crosswalk and found out I can change that switch within that. I will feed back when/if I can manage that. – halil Jun 16 '15 at 08:51
1

Except Samsung s4 with Android 5.0.1 , rest all devices return webgl true.

  • | Nexus 9 | Android 5.0 | webgl works |
  • | Nexus 6 | 5.1.1 | webgl works |
  • | htc | 4.4.4 | webgl works |
  • | samsung galaxy note 4 | 5.0.1 | webgl works |
  • | samsung s4 | 5.0.1 | webgl doesn’t work |
  • | samsung s5 | 6.0 | webgl works |
  • | Nexus 5 | 6.0 | webgl works|
  • | MotoX | 6.0 | webgl works |
Pratap Dessai
  • 101
  • 1
  • 3