Shader Configuration Class
Shaders are (sub-) programs for download and execution in the computers graphics hardware (GPU).
They are drastically faster than javascript programs and run massivly in parallel, which makes
very powerful animations possible.
Shaders are an inherent feature of canvas 3D / WebGL™. They are not available on browsers
that only support 2D canvas. On those browsers taccgl™ shader definitions are
silently ignored. To create cross browser pages, ignoring shaders
is an option that might look ok in some cases while in others it can be necessary
to provide an alternative animation for 2D mode. See ddmode.
taccgl™ provides standard shaders that are taken by default. In addition you can create
custom shaders by adding custom code to the standard shaders. This enables outstanding
animations, but on the other hand requires some more or less complex shader programming.
While even then taccgl™ handles most of the complexity of WebGL, you at least need
some basic knowledge of shader programming (Standard Documents).
A shader configuration object has methods to generate a pair of vertex and fragment shaders and
code to pass input data to the shaders from the javascript program.
Also the standard shader is encapsulated as a shader configuration object.
It is stored in taccgl.stdsc. At least for now, however, there is no way to configure
the standard shader.
A shader configuration object generates shaders on the fly. If the graphics hardware
does not support certain features or a shader is too complex for the hardware used, then taccgl™ disables
certain features (e.g. shadows) to simplify the shader.
taccgl™ always generates multiple pairs of shaders and decides while running the animation based
on the current performance which pair of shaders to use. Typically there are a pair of shaders that supports
shadows for high performance GPUs, normal shaders with per fragment lighting and specular lights, and a
fast shader with per vertex lighting.
A custom shader configuration object can be created using ssc. This shader can
then be configured using methods described below. Afterwards it can be used by one or more
transitions using sc.
WebGL™ is a trademark of the Khronos Group Inc.
|