cocos.shader module

exception GLSLException

Bases: Exception

class VertexShader(name, prog)

Bases: cocos.shader.Shader

shaderType()
class FragmentShader(name, prog)

Bases: cocos.shader.Shader

shaderType()
class ShaderProgram(vertex_shader=None, fragment_shader=None)

Bases: object

destroy()
install()
prog()
setShader(shader)
classmethod simple_program(name, vertex_code, fragment_code)

Intended to cut boilerplate when doing simple shaders

name : string with program name vertex_code : None or string with the vertex shader code fragment_code : None or string with the fragment shader code

uniformLoc(var)
uninstall()
uset1F(var, x)
uset1I(var, x)
uset2F(var, x, y)
uset2I(var, x, y)
uset3F(var, x, y, z)
uset3I(var, x, y, z)
uset4F(var, x, y, z, w)
usetM4F(var, matrix, transpose=False)
usetTex(var, unit, target, tx)

var : name of variable to write unit : texture unit target : target for glBindTexture tx : texture ID