Coin
4.0.3
Coin3D core library
|
Coin 2.5 added support for shaders. The main nodes used are SoShaderProgram, SoVertexShader, SoFragmentShader, and SoGeometryShader. A typical scene graph with shaders will look something like this:
This will render the cube with the vertex and fragment shaders specified in myvertexshader.glsl and myfragmentshader.glsl. Coin also supports ARB shaders and Cg shaders (if the Cg library is installed). However, we recommend using GLSL since we will focus mostly on support this shader language.
Coin defines some named parameters that can be added by the application programmer, and which will be automatically updated by Coin while traversing the scene graph.
Example scene graph that renders per fragment OpenGL Phong lighting for one light source. The shaders assume the first light source is a directional light. This is the case if you open the file in a standard examiner viewer.
The iv-file:
The vertex shader (perpixel_vertex.glsl):
The fragment shader (perpixel_fragment.glsl):