Jitter provides a means of encapsulating shader parameters and programs through an XML based shader description file (JXS). This JXS file offers an easy way of setting up any required OpenGL state to achieve a particular effect, without any additional patcher related work.
The JXS file may contain a list of parameters and textures, followed by a set of language dependent implementations for the shader's vertex and fragment programs.
Each language implementation must specify both a vertex and a fragment program. These programs may either reference external files, or be stored inline within a CDATA section or an XML comment. Programs for each language implementation will be loaded and bound in the order that they are listed in the JXS file. If a particular language implementation fails to compile, the next implementation will be used, until a successful candidate is found.
Inside of the language implementation declaration, any shader parameter previously specified must be identified with a bind tag that indicates which shader program should receive the parameter's values.
The following listing outlines the format of a typical JXS file:
<jittershader name="”myshader”>"
<!-- optional description -->
<description>This is my shader</description>
<!-- optional list of texture objects to bind -->
<texture file="mytexture.jpg"/>
<!-- optional list of shader parameters -->
<param="myparam" type="vec3" default="3.0 4.0 5.0">
<description>This is my parameter</description>
</param>
<!-- list of language implementations -->
<language type="glsl" version="1.0">
<!-- list of binding targets for shader parameters -->
<bind param="myparam" program="vp"/>
<!-- vertex and fragment programs -->
<program name="vp" type="vertex" source="sh.passthru.xform.vp.glsl"/>
<program name="fp" type="fragment">
<![CDATA[
// entry point
void main()
{
gl_FragColor=vec4(0.5, 0.5, 0.5, 1.0);
}
]]>
</program>
</language>
</jittershader>
Note that the XML document must be well-formed with matching opening/closing tags.
Any of the following XML tags may be used inside the JXS document: