OpenGL.GLES2.shaders
Convenience module providing common shader entry points
The point of this module is to allow client code to use
OpenGL Core names to reference shader-related operations
even if the local hardware only supports ARB extension-based
shader rendering.
There are also two utility methods compileProgram and compileShader
which make it easy to create demos which are shader-using.
Functions
compileShader(
source
,
shaderType
)
Compile shader source of given type
- source
- GLSL source-code for the shader
- shaderType
- GLenum GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc,
returns GLuint compiled shader reference
raises RuntimeError when a compilation failure occurs
Classes
class ShaderProgram(
int
):
Integer sub-class with context-manager operation
check_validate(
self
)
Check that the program validates
Validation has to occur *after* linking/loading
raises RuntimeError on failures
load(
self
,
format
,
binary
)
Attempt to load binary-format for a pre-compiled shader
See notes in retrieve
retrieve(
self
)
Attempt to retrieve binary for this compiled shader
Note that binaries for a program are *not* generally portable,
they should be used solely for caching compiled programs for
local use; i.e. to reduce compilation overhead.
returns (format,binaryData) for the shader program