Is it possible to run #version 120 shaders with WebGL
Asked Answered
M

1

10

I have a number of GLSL fragment shaders for which I can pretty much guarantee that they conform to #version 120 They use standard, non-ES conformant values and they do not have any ES-specific pragmas.

I really want to make a web previewer for them using WebGL. The previewer won't be used on mobile. Is this feasible? Is the feature set exposed to GLSL shaders in WebGL restricted compared to that GLSL version? Are there precision differences?

I've already tried playing with THREE.js but that doesn't really rub it since it mucks up my shader code before loading it onto the GPU (which I cannot do).

In short: is the GLSL spec sufficient for me to run those shaders?.. because if it isn't what I am after is not doable and I should just drop it.

Marko answered 13/1, 2014 at 23:34 Comment(0)
S
12

No, WebGL shaders must be version #100. Anything else is disallowed.

If you're curious why it's because, as much as possible, WebGL needs to run everywhere. If you could choose any version your web page would only run on systems with GPUs/Drivers that handled that version.

The next version of WebGL will raise the version number. It will allow GLSL ES 3.0 (note the ES). It's currently available behind a flag in Chrome and Firefox as of May 2016

Snaky answered 14/1, 2014 at 2:46 Comment(1)
Thanks. Makes me sad (even though this is a very specific use case).Marko

© 2022 - 2024 — McMap. All rights reserved.