vispy.visuals.shaders.shader_object module

class vispy.visuals.shaders.shader_object.ShaderObject

Bases: object

Base class for all objects that may be included in a GLSL program (Functions, Variables, Expressions).

Shader objects have a definition that defines the object in GLSL, an expression that is used to reference the object, and a set of dependencies that must be declared before the object is used.

Dependencies are tracked hierarchically such that changes to any object will be propagated up the dependency hierarchy to trigger a recompile.

changed(code_changed=False, value_changed=False)

Inform dependents that this shaderobject has changed.

compile()

Return a compilation of this object and its dependencies.

Note: this is mainly for debugging purposes; the names in this code are not guaranteed to match names in any other compilations. Use Compiler directly to ensure consistent naming across multiple objects.

classmethod create(obj, ref=None)

Convert obj to a new ShaderObject. If the output is a Variable with no name, then set its name using ref.

definition(obj_names, version, shader)

Return the GLSL definition for this object. Use obj_names to determine the names of dependencies, and version (number, qualifier) to adjust code output.

dependencies(sort=False)

Return all dependencies required to use this object. The last item in the list is self.

expression(obj_names)

Return the GLSL expression used to reference this object inline.

property name

The name of this shader object.

static_names()

Return a list of names that are declared in this object’s definition (not including the name of the object itself).

These names will be reserved by the compiler when automatically determining object names.

property version_pragma

Return version number and extra qualifiers from pragma if present.