(Using WordPress to Power 3d Interfaces)
Developer, WebDevStudios / Maintainn
WebGL: Are We There Yet?
Sort of. It depends on what you’re doing.
Let’s review some common use-cases
Like any application, there are two primary environments in which assets may be:
Graphically-intensive interfaces typically use native 3d interpreters.
Until recently, hardware acceleration for WebGL had terrible support.
The post, by the Khronos (2009): https://www.khronos.org/news/press/khronos-webgl-initiative-hardware-accelerated-3d-graphics-internet
It’s active by default on the latest desktop browsers:
What applications frequently employ a 3d interface? Any user of ~~INTERNETS~~ is in some way familiar with one or more of these interfaces:
Some of the most common are:
Is WebGL worth your time yet?
What’s the coverage like?
Good enough to use, but not good enough to drop the necessity of a fallback UI.
What’s a good fallback look like?
The feature detection libs you’re already used to can help (plus Detector.js, if you want).
Ok. So, if WebGL doesn’t load…
Your responsibility is still the same as any other projects’ catches.
Bail entirely, and load nothing dependent upon the WebGL environment.
Then load the fallback UI.
1. Check for WebGL support with
2. Failing that, check for the 2D API:
3. Failing that, bail and do something else entirely.
Detector.js = simple and effective
Modernizr and other feature-detection libs work as well, if one is part of your build already.
Let’s get to the WP stuff.
Please put on your 3d glasses now.
Let us consider the most noble of 3d shapes: a sphere.
A sphere with an external camera view. Data loaded from WordPress within a typical template. Passed to js via data-attributes.
A sphere with an internal camera view (hdri map). Data loaded from WordPress via wp_localize_script.New to wp_localize_script? Read this.
Yet another use-case.
That’s cool and junk, but…
What’s a “bad” example?
A no-good very-bad use case.
getbloginfo( 'name' ) inline as well.
ok I am done talking now