Is it possible to run #version 120 shaders using WebGL

I have several GLSL fragment shaders for which I can pretty much guarantee that they are consistent #version 120. They use standard non-ES values ​​and they don’t have any pragmas. for ES.

I really want to do a web preview for them using WebGL. Preview will not be used on mobile devices. Is it possible? Is the feature set open to GLSL shaders in WebGL limited compared to this version of GLSL? Are there differences in accuracy?

I already tried playing with THREE.js, but that doesn't really rub it in, since it loads my shader code before downloading it to the GPU (which I can't do).

In short: is the GLSL specification enough to run these shaders? .. because if that’s not what I am doing, it’s not possible and I just have to give it up.

+4
source share
1 answer

No, WebGL shaders must be version 100. Everything else is forbidden.

If you're wondering why this is so, as much as possible, WebGL needs to be run everywhere. If you can choose any version, your web page will only work on systems with GPUs / drivers that processed this version.

The next version of WebGL will raise the version number. This will enable GLSL ES 3.0 (pay attention to ES ). It is currently available behind the flag in Chrome and Firefox as of May 2016.

+3

All Articles