Webgl not working


#1

I need webgl for android and ios to work. Right now I am just focusing on android. From my understanding if I download crosswalk webgl should work. So I added crosswalk o my project with the command ‘ionic browser add crosswalk’ and everything seemed to install fine. The layout now looks a little different and scrolling has improved. The problem is when I try to use webgl it gives a black box in my app and it says this browser doesn’t support webgl. Is there anything else I need to do?

PS: As a second option I looked into cocoonjs which also apperntly supports webgl. I removed crosswalk and installed cocoonjs witht he command ‘ionic plugin add com.ludei.webview.plus -d’ and everything seems to install fine. Then I tried to run my app and I got the same result saying my browser doesn’t support webgl.


#2

Hi
crosswalk includes webgl but chromium has a gpu black list which doesn’t allow some phones to work with webgl but you can disable this blacklist with the command : --ignore-gpu-blacklist
I made a blank project and added crosswalk and searched for xwalk and find this answer for ionic:

I have not tested this but it’s easy to revert changes so you can try it
In your project directory there are two .gradle files which has “xwalk” in their names, search for them and do this for both:

find: def DEFAULT_COMMAND_LINE
add --ignore-gpu-blacklist with a space seperating with previous command(s) between " marks,
for me the line would be like this:
def DEFAULT_COMMAND_LINE = “–disable-pull-to-refresh-effect --ignore-gpu-blacklist”

Hope it will be helpful

EDIT:
Now I have tested It with my Samsung Galaxy S6 with this code:

and without the thing I said It didn’t start webgl and threw an error but when when I did what I said it worked :slight_smile:


#3

Thank you very much for the information! I will give it a try later tonight.

Out of curiosity is there a reason why some devices are blacklisted and others are not?

And just for future planning since crosswalk is only for android, would you happen to know how to enable it for ios?


#4

I have now tried this but it did not work for me, the error still shows up.

I edited xwalk.gradle and mobileapp510592-xwalk.gradle.

I changed the line:

def DEFAULT_COMMAND_LINE = “–disable-pull-to-refresh-effect”

to

def DEFAULT_COMMAND_LINE = “–disable-pull-to-refresh-effect --ignore-gpu-blacklist”

for both files. Then I ran ionic build android and ionic run android. The error message still shows up for me though.