10 Replies Latest reply on Dec 9, 2016 1:32 PM by Amidos

    WebGL on Android Lollipop

    Amidos Level 1

      Hello everyone,

      Its my first time to use phonegap and first time to post here. I spent the last 2 days trying to know why my game is slow on my Nexus 10 tablet but I couldn't know. Then suddenly I ran my game in Chrome and it was super fast so I googled more and I find out that PhoneGap on my Nexus is rendering in CANVAS mode instead of WebGL. My Android is 5.1.1 (its not that old). Any help how to fix that? Also same happens with my iPad mini 1 although it has iOS 9.


      Any help?


      Thanks in advance

        • 1. Re: WebGL on Android Lollipop
          kerrishotts Adobe Employee

          Are you using a gaming framework?

          • 2. Re: WebGL on Android Lollipop
            Amidos Level 1

            Yup using Phaser which is based on PIXI but forcing to WebGL, it work well with newer phones but on lollipop and iOS 9 both runs on CANVAS if I switch to Auto and if force to WEBGL it won't work and crash on these devices

            • 3. Re: WebGL on Android Lollipop
              kerrishotts Adobe Employee

              Given that this is a third-party framework, I'm not sure how much this forum can be of help. You might want to ask over on the Phaser forums why Lollipop/iOS 9 isn't using WebGL.


              BUT, given that you say it crashes if you force WebGL, there may be a very good reason that Phaser doesn't switch to WebGL automatically. There's lots of buggy implementations out there, and in many cases it may even depend on your Android device manufacturer (drivers, etc.).


              Do make sure that:


              1. You are using WKWebView for iOS (modern, 3x JS speed, WebGL support)
              2. You are using Crosswalk for Android (modern, consistent environment)


              If you aren't sure if you're using the above, please share your config.xml (minus identifying/secret information), and we can take a look at the plugin list.

              • 4. Re: WebGL on Android Lollipop
                Amidos Level 1

                I force it to use WebGL and PhoneGap throw an error that the Webview doesn't support WebGL.

                If I use the same code with newer device phonegap can render WebGL

                • 5. Re: WebGL on Android Lollipop
                  Amidos Level 1

                  I will try using the suggestions but I tried CrossWalk and I don't find any difference it still say it doesn't support WebGL. May be I used CrossWalk wrong but I put <plugin name="org.crosswalk.engine" spec="1.3.0" source="pgb" />

                  in the config.xml


                  Or it doesn't work on the fly testing of Phonegap app on the phone?


                  Shouldn't that be enough?

                  • 6. Re: WebGL on Android Lollipop
                    VectorP Level 4


                    The pgb repo is closed down.

                    You need to find the plugin at npm.

                    • 7. Re: WebGL on Android Lollipop
                      Amidos Level 1

                      Thanks Will try that and get back here but Why Phonegap website still say to do that?

                      • 8. Re: WebGL on Android Lollipop
                        Amidos Level 1

                        btw is it the same just change to npm or should it be like that

                        <plugin name="cordova-plugin-crosswalk-webview" spec="1.3.0" source="npm" />


                        or should it be as a preference? as they are suggesting on npm


                        <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library:14+" />

                        • 9. Re: WebGL on Android Lollipop
                          kerrishotts Adobe Employee

                          Moved to PGB forum, since you're evidently using PhoneGap Build. If you aren't, let me know, and I'll move it back.


                          As to your last post -- the two lines mean different things:


                          <plugin name="cordova-plugin-crosswalk-webview" spec="1.3.0" source="npm" />

                          This tells PhoneGap to use 1.3.0 of the crosswalk plugin, hosted at npm.


                          <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library:14+" />



                          This tells Crosswalk which version of their libraries to use (there are several from which you can choose).


                          However, since you're using PhoneGap Build, you'll also want to switch to a different Crosswalk plugin as PGB doesn't support saving the multiple APKs the regular Crosswalk plugin will create. Instead, use one of the architecture-specific plugins (ARM or x86) here: http://cordova.apache.org/plugins/?q=pgb-adapt

                          • 10. Re: WebGL on Android Lollipop
                            Amidos Level 1

                            Just tried all of these stuff even I compiled an apk instead of using the testing online and still using CANVAS not webgl ??

                            I don't know what to do???