Migrating custom Forge viewer shaders to WebGL 2 Part 1

An interesting thing happened when I tried Dasher 360 with the latest production version of the Forge viewer: no sensor dots appeared. As Dasher without sensors is a glorified 3D viewer, this was a bit of a problem.

Digging into things a little, I worked out that our custom WebGL shader wasn’t working properly in this latest version.

Something's broken

At this point I reached out to my friend Elias Cohenca in Tel Aviv for a quick sanity check: he confirmed that this latest version of the Forge viewer is now defaulting to WebGL 2.0. This was confirmed in the Forge viewer change-log, where there was this innocent-looking line-item:

This version will attempt to initialize using a WebGL2 and will fallback into WebGL1.

As far as I can tell this means that WebGL 2 will be used if your device supports it, not based on whether your application has been migrated to support WebGL 2 (although for all I know there may also be a setting somewhere to force the use of WebGL 1).

Anyway, after realising this was at…

Read more