96. opengl.shader — OpenGL shader programs
Python OpenGL framework for pyFormex
This module is responsible for loading the shader programs
and its data onto the graphics system.
- 2013 Benedict Verhegghe and the pyFormex project.
96.1. Classes defined in module opengl.shader
- 
class opengl.shader.Shader(vshader=None, fshader=None, attributes=None, uniforms=None)[source]
- An OpenGL shader consisting of a vertex and a fragment shader pair. - Class attributes: - 
- _vertexshader : the vertex shader source.
By default, a basic shader supporting vertex positions and vertex colors
is defined
- _fragmentshader : the fragment shader source.
By default, a basic shader supporting fragment colors is defined.
- attributes: the shaders’ vertex attributes.
- uniforms: the shaders’ uniforms.
 - 
- 
locations(func, keys)[source]
- Create a dict with the locations of the specified keys 
 - 
- 
uniformInt(name, value)[source]
- Load a uniform integer or boolean into the shader 
 - 
- 
uniformFloat(name, value)[source]
- Load a uniform float into the shader 
 - 
- 
uniformVec3(name, value)[source]
- Load a uniform vec3[n] into the shader - The value should be a 1D array or list. 
 - 
- 
uniformMat4(name, value)[source]
- Load a uniform mat4 into the shader 
 - 
- 
uniformMat3(name, value)[source]
- Load a uniform mat3 into the shader 
 - 
- 
bind(picking=False)[source]
- Bind the shader program 
 - 
- 
unbind()[source]
- Unbind the shader program 
 - 
- 
loadUniforms(D)[source]
- Load the uniform attributes defined in D - D is a dict with uniform attributes to be loaded into
the shader program. The attributes can be of type
int, float, or vec3. 
 
 
96.2. Functions defined in module opengl.shader
- 
opengl.shader.defaultShaders()[source]
- Determine the default shader programs