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
compileProgram(
*
shaders
,
**
named
)
Create a new program, attach shaders and validate
- shaders
- arbitrary number of shaders to attach to the generated program.separable (keyword only) -- set the separable flag to allow for partial installation of shader into the pipeline (see glUseProgramStages)retrievable (keyword only) -- set the retrievable flag to allow retrieval of the program binary representation, (see glProgramBinary, glGetProgramBinary)
This convenience function is *not* standard OpenGL,
but it does wind up being fairly useful for demos
and the like. You may wish to copy it to your code
base to guard against PyOpenGL changes.
Usage:
shader = compileProgram(
compileShader( source, GL_VERTEX_SHADER ),
compileShader( source2, GL_FRAGMENT_SHADER ),
)
glUseProgram( shader )
Note:
If (and only if) validation of the linked program
*passes* then the passed-in shader objects will be
deleted from the GL.
returns ShaderProgram() (GLuint) program reference
raises RuntimeError when a link/validation failure occurs
Classes
class ShaderProgram(
int
):