Force WebGL1

  • Hi Ashley

    Samsungs latest update to their latest devices ( in this case, S7 onwards ) causing games using WebGL2 to crash ( on Instant Games at least ). This was confirmed on the FB developer forum and once i disabled WebGL the game worked fine. However, the suggestion was to Force WebGL1. Is there an option to do that in C3? Or any other way to do it? The game takes a big FPS hit when WebGL is disabled.

    Thanks,

    Peter

  • Presumably the crash will affect all web content, so I think it would be best to report the issue to Google so they can blacklist WebGL 2 on those devices.

  • So "no" is what you are saying :D I assume Samsung will fix it themselves soon, people have reported it working reverting to WebGL1. Il report it to google nonetheless to hopefully speed things up.

    Thanks,

    Peter

  • Ashley

    I thought Samsung or whoever is at fault would have resolved this by now but the issue is still there... Your suggestion to get Google to blacklist those devices doesn’t make sense when WebGL1 or disabled works fine... Is there any possible way to use WebGL1, in C3.

    Thanks,

    Peter

  • In your runtime you can search for this string

    this.g_cu=this.canvas.getContext("webgl2",l)||this.canvas.getContext("webgl",l)||this.canvas.getContext("experimental-webgl",l)

    if you amend webgl2 to just webgl, it will not try to use webgl2 at all.

    ashley can maybe verify this

  • Thanks a lot Fred, I’ll give that a try

  • fredriksthlm

    You genius, i changed the following at and worked perfectly and is working on all devices now!!

    "var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2") === 0);"

    Changed to:

    "var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL") === 0);"

    Thank you so much ( again )

    Peter

  • METR1C

    Glad I could help!

    Ashley

    Maybe you can have this as a setting in the Project properties. To chose "Highest WebGL version/webGL2" or to "force webgl1" if actually some people need it for some reason..

  • "var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2") === 0);"

    Changed to:

    "var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL") === 0);"

    In which folder and file name did you find these lines of code?

    Thank you for your answer

  • pls tell me too, where to edit this code. Thank you

  • We don't add new project settings just to deal with temporary bugs. It would end up clogging up Construct with all sorts of unnecessary settings.

    Google can blacklist WebGL 2 only if there is a problem with it on some devices, so that those devices fall back to WebGL 1. This is the best solution, especially since bugs will affect all web content, not just Construct.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • >

    > "var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2") === 0);"

    >

    > Changed to:

    >

    > "var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL") === 0);"

    >

    In which folder and file name did you find these lines of code?

    Thank you for your answer

    It is in the runtime file. You must export it as not minified

  • Note that code does not actually disable WebGL 2. It will still use WebGL 2, but you've overwritten some code to make it always think it's using WebGL 2 even when it's using WebGL 1, which probably isn't what you want at all. Changing the call to getContext("webgl2") instead would work.

  • Note that code does not actually disable WebGL 2. It will still use WebGL 2, but you've overwritten some code to make it always think it's using WebGL 2 even when it's using WebGL 1, which probably isn't what you want at all. Changing the call to getContext("webgl2") instead would work.

    Yepp, getContext(”webgl2”) is what I referenced above in the beginning.

    That would work also for minified I guess?

    But I don’t really know if it is webgl2 or the regular webgl causing the issue actually..

    It would be really nice to just fix this easily in our runtime when we export. Cause this is a BIG issue in instant games, apks and everyting tht opens on androids :(

    It startet like three weeks ago, when webview got to 67 or 68 or something

  • It would be better to pursue Samsung or Google about this since the problem is not with Construct.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)