elm-explorations / webgl

Functional rendering with WebGL in Elm
https://package.elm-lang.org/packages/elm-explorations/webgl/latest/
BSD 3-Clause "New" or "Revised" License
116 stars 17 forks source link

Added support for WebGL 2.0 (and possibility of GLSL 3.0 support) #22

Closed roboguy13 closed 5 years ago

roboguy13 commented 5 years ago

This adds support for WebGL 2.0. Among other things, this opens up the possibility of supporting GLSL 3.0.

I believe my change is backwards compatible with WebGL <2.0 as far as the existing webgl API goes, but I have not yet tested this. The logging code I added should show that the correct version is, in fact, being used (when logging is enabled by uncommenting the logging function body).

Based on this list of backwards incompatibilities between WebGL 2.0 and WebGL 1.0, it sounds like most of them are just WebGL 2.0 being more lenient about certain things. It does not sound like the other incompatibilities apply here, since I do not see DEPTH_ATTACHMENT, etc, being used in this package (though I could be mistaken).

A side-note about GLSL 3.0: At the moment, there is an issue upstream with the GLSL parser package used by the Elm compiler which I believe is preventing GLSL 3.0 from being used (even with the change here). I will see if I can patch this package as well. This is the relevant issue on that package. GLSL assumes that version 1.10 is being used, unless a #version preprocessor directive says otherwise.

It is worth noting that GLSL 1.10 is 15 years old.

w0rm commented 5 years ago

Good to know that this is very easy to add.

Closing because: