jit.gl.shader Manages a GL shader

The jit.gl.shader object manages the process of compiling, binding and submitting a shader to OpenGL. A shader consists of both a vertex program and a fragment (aka pixel) program written which may each have a set of user controllable parameters. These programs can be defined in a xml shader description file (JXS), or submitted individually. Currently the high level languages GLSL and CG, as well as ARB, and NV assembly programs are supported. Shaders can be attached to any OB3D thru the OB3D shader method. If the shader is attached to an OB3D, the OB3D will automatically manage the compiling and binding for the jit.gl.shader object. The jit.gl.shader object requires one argument: the name of a drawing context. A named drawing context is a named instance of a jit.window, jit.pwindow, or jit.matrix object that has an instance of the jit.gl.render object associated with it. This value may also be set via the OB3D drawto attribute.

GL Group

Attributes:
Name Type Description
file symbol The shader description file (JXS) to use (default = none)
prefer symbol The language to prefer if multiple programs have been specified. (default = none) Supported options are:
none
glsl
cg
arb
nv
compiler symbol The compiler to use for compiling shader programs. (default = native) Supported compilers are:
native (native compiler in graphics driver)
internal (internal jitter compiler)
verbose long Enables or disables verbose output to the max console window (default = 0).
param atom list[256] Sets the given parameter with the given atom values.

Messages:
dump [type (symbol)]
Dumps the indicated shader data to the max console window. Valid types are params, source, assembly.

getparamlist
Sends the names of all the shader parameters out the right-most outlet.

getparamtype [name (symbol)]
Sends the name of the datatype for the indicated shader parameter out the right-most outlet.

getparamval [name (symbol)]
Sends the data values for the indicated shader parameter out the right-most outlet.

getparamdefault [name (symbol)]
Sends the default data values for the indicated shader parameter out the right-most outlet.

read [filename (symbol)]
Loads the given JXS shader file from disk.

flush_cache
Clears the shader cache which stores loaded programs that have been compiled in order to minimize compile time for shaders that have already been compiled and have not been modified on disk.

arb [vpfile (symbol)] [fpfile (symbol)]
Loads the given arb vertex and fragment programs from disk.

arbvp [vpfile (symbol)]
Loads the given arb vertex program from disk.

arbfp [fpfile (symbol)]
Loads the given arb fragment program from disk.

glsl [vpfile (symbol)] [fpfile (symbol)]
Loads the given glsl vertex and fragment programs from disk.

glslvp [vpfile (symbol)]
Loads the given glsl vertex program from disk.

glslfp [fpfile (symbol)]
Loads the given glsl fragment program from disk.

cg [vpfile (symbol)] [fpfile (symbol)]
Loads the given cg vertex and fragment programs from disk.

cgvp [vpfile (symbol)]
Loads the given cg vertex program from disk.

cgfp [fpfile (symbol)]
Loads the given cg fragment program from disk.

bind
Manually binds and compiles the shader object.

unbind
Manually unbinds the shader object.

compile
Manually compiles the shader object.

Example:

See Also:
jit.gl.graph, jit.gl.gridshape, jit.gl.handle, jit.gl.isosurf, jit.gl.mesh, jit.gl.model, jit.gl.nurbs, jit.gl.plato, jit.gl.render, jit.gl.sketch, jit.gl.slab, jit.gl.text2d, jit.gl.text3d, jit.gl.texture, jit.gl.videoplane, jit.gl.volume