Pass:setShader

Edit

Sets the active shader. The Shader will affect all drawing operations until it is changed again.



Arguments

NameTypeDescription
shaderShader | DefaultShader The shader to use.

Returns

Nothing

Switch back to using an automatic shader for drawing.

Arguments

None

Returns

Nothing

Notes

Changing the shader will preserve variable values (the ones set using Pass:send) unless the new shader declares a variable with the same as one in the old shader, but a different type. The variable "type" means one of the following:

If there's a clash in types, the variable will be reset to use a default resource:

Uniform variables with basic types like float, vec3, mat4, etc. will have their data preserved as long as both shaders declare the variable with the same name and type.

See also