BL_Shader(PyObjectPlus)

base class — PyObjectPlus

class bge.types.BL_Shader(PyObjectPlus)

BL_Shader GLSL shaders.

TODO - Description

setUniformfv(name, fList)

Set a uniform with a list of float values

Parameters:
  • name (string) – the uniform name
  • fList (list[float]) – a list (2, 3 or 4 elements) of float values
delSource()

Clear the shader. Use this method before the source is changed with setSource.

getFragmentProg()

Returns the fragment program.

Returns:The fragment program.
Return type:string
getVertexProg()

Get the vertex program.

Returns:The vertex program.
Return type:string
isValid()

Check if the shader is valid.

Returns:True if the shader is valid
Return type:boolean
setAttrib(enum)

Set attribute location. (The parameter is ignored a.t.m. and the value of “tangent” is always used.)

Parameters:enum (integer) – attribute location value
setNumberOfPasses(max_pass)

Set the maximum number of passes. Not used a.t.m.

Parameters:max_pass (integer) – the maximum number of passes
setSampler(name, index)

Set uniform texture sample index.

Parameters:
  • name (string) – Uniform name
  • index (integer) – Texture sample index.
setSource(vertexProgram, fragmentProgram)

Set the vertex and fragment programs

Parameters:
  • vertexProgram (string) – Vertex program
  • fragmentProgram (string) – Fragment program
setUniform1f(name, fx)

Set a uniform with 1 float value.

Parameters:
  • name (string) – the uniform name
  • fx (float) – Uniform value
setUniform1i(name, ix)

Set a uniform with an integer value.

Parameters:
  • name (string) – the uniform name
  • ix (integer) – the uniform value
setUniform2f(name, fx, fy)

Set a uniform with 2 float values

Parameters:
  • name (string) – the uniform name
  • fx (float) – first float value
  • fy (float) – second float value
setUniform2i(name, ix, iy)

Set a uniform with 2 integer values

Parameters:
  • name (string) – the uniform name
  • ix (integer) – first integer value
  • iy (integer) – second integer value
setUniform3f(name, fx, fy, fz)

Set a uniform with 3 float values.

Parameters:
  • name (string) – the uniform name
  • fx (float) – first float value
  • fy (float) – second float value
  • fz (float) – third float value
setUniform3i(name, ix, iy, iz)

Set a uniform with 3 integer values

Parameters:
  • name (string) – the uniform name
  • ix (integer) – first integer value
  • iy (integer) – second integer value
  • iz (integer) – third integer value
setUniform4f(name, fx, fy, fz, fw)

Set a uniform with 4 float values.

Parameters:
  • name (string) – the uniform name
  • fx (float) – first float value
  • fy (float) – second float value
  • fz (float) – third float value
  • fw (float) – fourth float value
setUniform4i(name, ix, iy, iz, iw)

Set a uniform with 4 integer values

Parameters:
  • name (string) – the uniform name
  • ix (integer) – first integer value
  • iy (integer) – second integer value
  • iz (integer) – third integer value
  • iw (integer) – fourth integer value
setUniformDef(name, type)

Define a new uniform

Parameters:
  • name (string) – the uniform name
  • type (UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX) – uniform type
setUniformMatrix3(name, mat, transpose)

Set a uniform with a 3x3 matrix value

Parameters:
  • name (string) – the uniform name
  • mat (3x3 matrix) – A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]]
  • transpose (boolean) – set to True to transpose the matrix
setUniformMatrix4(name, mat, transpose)

Set a uniform with a 4x4 matrix value

Parameters:
  • name (string) – the uniform name
  • mat (4x4 matrix) – A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]]
  • transpose (boolean) – set to True to transpose the matrix
setUniformiv(name, iList)

Set a uniform with a list of integer values

Parameters:
  • name (string) – the uniform name
  • iList (list[integer]) – a list (2, 3 or 4 elements) of integer values
validate()

Validate the shader object.

Previous topic

BL_ArmatureObject(KX_GameObject)

Next topic

BL_ShapeActionActuator(SCA_IActuator)