A newer version of Max is available. Click here to access the latest version of this document.


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.

Information for Jitter 3D Object (OB3D) messages and attributes to this object


(drag) When a shader file is dragged from the Max 5 File Browser to a jit.gl.shader object, the file will be loaded.
arb vpfile [symbol]
fpfile [symbol]
Loads the given arb vertex and fragment programs from disk.
arbfp fpfile [symbol]
Loads the given arb fragment program from disk.
arbvp vpfile [symbol]
Loads the given arb vertex program from disk.
dispose Dispose of and unload the current shader.
dump type [symbol]
Dumps the indicated shader data to the max console window. Valid types are params, source, assembly.
cg vpfile [symbol]
fpfile [symbol]
Loads the given cg vertex and fragment programs from disk.
cgfp fpfile [symbol]
Loads the given cg fragment program from disk.
cgvp vpfile [symbol]
Loads the given cg vertex program from disk.
bind Manually binds and compiles the shader object.
compile Manually compiles the shader object.
getparamdefault name [symbol]
Sends the default data values for the indicated shader parameter out the right-most outlet.
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.
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.
glsl vpfile [symbol]
fpfile [symbol]
Loads the given glsl vertex and fragment programs from disk.
glslfp fpfile [symbol]
Loads the given glsl fragment program from disk.
glslvp vpfile [symbol]
Loads the given glsl vertex program from disk.
param Sets the given shader parameter with the given atom values as defined in a JXS (Jitter shader) file.
program_param A geometry shader program parameter.
read filename [symbol]
Loads the given JXS shader file from disk.
unbind Manually unbinds the shader object.


Name Type g/s Description
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)
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:
shader symbol For internal use only.
verbose int Enables or disables verbose output to the max console window (default = 0).

Information for box attributes common to all objects


See Also

Name Description
jit.gl.graph Open GL floating-point data visualization
jit.gl.gridshape Generate simple geometric shapes as a connected grid
jit.gl.handle Use mouse movement to control position/rotation
jit.gl.isosurf Generates a GL based surface extraction
jit.gl.mesh Generates GL geometry from existing data
jit.gl.model Read and draw Wavefront .obj models
jit.gl.nurbs Generate NURBS surface
jit.gl.plato Generate platonic solids
jit.gl.render Render Open GL
jit.gl.sketch GL parallel to lcd
jit.gl.slab Performs a GL accelerated grid-based evaluation
jit.gl.text2d Write bitmap text
jit.gl.text3d Write vector text
jit.gl.texture Manages a GL texture
jit.gl.videoplane GL accelerated video plane
jit.gl.volume Creates a GL accelerated volume vizualization
Tutorial 41: Shaders Tutorial 41: Shaders