Posted on

Shaders

Simple shader support added (currently GLSL 1.2 / OpenGL 2.0 with > versions in the pipeline). Adding a shader involves dropping text file pairs (fragment / vertex) into a directory that are then compiled with their uniform variables reflected on and a factory constructed to serve up instances during engine startup. Using a shader involves creating an instance of a shader (by selecting the appropriate shader factory in the UI) and then configuring its properties. A shader instance can then be assigned to a Material and a Material can then be assigned to any number of objects in the scene. Because shaders are organised into materials the material based sorting (i.e. sorting visible objects based on their material to reduce draw calls) still holds. Clearly there’s more to shading in many cases (multiple render passes to a variety of buffer objects for instance) but this kind of support could be added with a little thought.