2

I've been surprised to find out that my Android phone does not support OES_texture_float extension, but fully supports WebGL2, which has floating texture functionality as baseline. What could cause the lack of their support in WebGL1, and is there any way around it, besides emulating float textures in shaders or migrating everything to WebGL2 (which would require a massive rewrite of everything to support both options)?

Edit: it seems the answer to WebGL: Declining support for OES_texture_float on Android covers part of this question, though it seems strange that they expect us to move to WebGL2 which requires a lot of work to maintain backwards compatibility.

riv
  • 6,846
  • 2
  • 34
  • 63
  • It's not a lot of work to use WebGL2 if you stick to WebGL1 features. You can still use GLSL 1.0 and otherwise most things are the same. You can easily enable all available extensions on a WebGL1 context and have them appear using the WebGL2 api [for example](http://twgljs.org/docs/module-twgl.html#.addExtensionsToContext) so I'm guessing it's pretty easy. Basically get a webgl2 context, if it fails get a webgl1 context, enable all the extensions and add to the webgl1 context like the example linked. Then use the WebGL2 API for any things which were extensions in WebGL1 – gman Jun 13 '19 at 12:24
  • Off the top of my head, if the only extension you're using is OES_texture_float then the one thing you'd need to do different is float textures themselves, in WebGL2 you pass `RGBA32F` as internalFormat, in WebGL1 you pass `RGBA` and it's inferred from the type. That seems like a pretty trivial check, at init time `const floatInternalFormat = isWebGL2 ? gl.RGBA32F : gl.RGBA` – gman Jun 13 '19 at 12:42
  • Ah, I remember when tried to make something using WebGL2 there were quite a few things I had to change, but maybe that's because I wanted to use more features. In either case, I'd also want texture array support with fallback to atlases because that's something my app could really benefit from. – riv Jun 13 '19 at 13:20

0 Answers0