fsleyes.gl.shaders
¶
The shaders
package contains classes and functions for finding,
parsing, compiling, and managing OpenGL shader programs. Two types of shader
program are supported:
- GLSL 1.20 vertex and fragment shaders.
ARB_vertex_program
andARB_fragment_program
shader programs.
The glsl
and arbp
packages respectively define the
GLSLShader
and ARBPShader
classes, which may be
used to manage shader programs of the corresponding type.
Some package-level functions are defined here, for finding and loading shader source code:
getShaderDir
Returns the directory in which the ARB
andglsl
shader program source files can be found.getShaderSuffix
Returns the shader program file suffix to use. getVertexShader
Returns the vertex shader source for the given GL type (e.g. getFragmentShader
Returns the fragment shader source for the given GL type.
-
fsleyes.gl.shaders.
getShaderDir
()¶ Returns the directory in which the
ARB
andglsl
shader program source files can be found. A different directory will be returned depending on which OpenGL version is in use.
-
fsleyes.gl.shaders.
getShaderSuffix
()¶ Returns the shader program file suffix to use. A different suffix will be returned depending on which OpenGL version is in use.
-
fsleyes.gl.shaders.
getVertexShader
(prefix)¶ Returns the vertex shader source for the given GL type (e.g. ‘glvolume’).
-
fsleyes.gl.shaders.
getFragmentShader
(prefix)¶ Returns the fragment shader source for the given GL type.
-
fsleyes.gl.shaders.
_getShader
(prefix, shaderType)¶ Returns the shader source for the given GL type and the given shader type (‘vert’ or ‘frag’).
-
fsleyes.gl.shaders.
_getFileName
(prefix, shaderType)¶ Returns the file name of the shader program for the given GL type and shader type.
-
fsleyes.gl.shaders.
preprocess
(src)¶ ‘Preprocess’ the given shader source.
This amounts to searching for lines containing ‘#pragma include filename’, and replacing those lines with the contents of the specified files.