PYME.LMVis.shader_programs.shader_program module¶
- exception PYME.LMVis.shader_programs.shader_program.GLProgramException(*args, **kwargs)¶
Bases:
OSError
This class is used if an error in the OpenGLProgramHandler occurs You usually only pass the text message to the constructor and raise the exception
- class PYME.LMVis.shader_programs.shader_program.ShaderProgram(shader_path='./shaders/')¶
Bases:
object
This class handles all OpenGl-PROGRAM related stuff
This includes loading and adding shaders, compiling them and handling or raising exceptions.
- Parameters
shader_path – the folder that contains the shader sources ending with a ‘/’ It can be relative or absolute.
:raises GLProgramException if glUseProgram is not successful
- add_shader(shader_name, shader_type)¶
This method adds a new shader module to the program.
- Parameters
shader_name – the filename of the shader that should be loaded keep in mind that the shader_path was set in __init__
shader_type – defines the stage the shader should be added e.g. GL_VERTEX_SHADER, GL_FRAGMENT_SHADER
- Returns
nothing
- Raises
GLShaderLoadException if the shader could not be loaded
- Raises
GLProgramException if the shader could not be compiled
- get_uniform_location(uniform_name)¶
- link()¶
- use()¶
- PYME.LMVis.shader_programs.shader_program.read_shader(shader_name, path)¶
This method reads a given shader within a given file path
- Parameters
shader_name – the name of the shader file
path – the path where the shader is stored on disk
- Returns
a string representing the shader
- Raises
GLShaderLoadException if the shader could not be loaded