Interface IShaderProgram
A compiled shader program: its vertex and fragment stages, and the uniforms that are set on them.
public interface IShaderProgram : IDisposable
- Inherited Members
Properties
CompileErrors
The compiler's diagnostics when IsCompiled is false; empty otherwise.
string CompileErrors { get; }
Property Value
IsCompiled
Whether the program compiled for the active backend. OpenGL compiles a program when it is created and throws if it cannot, so there this is always true. Vulkan compiles on first use and, if it cannot, logs why and draws without the shader - so a game that loads a shader it did not write (a mod, a server owner's) checks this to tell somebody it is broken.
bool IsCompiled { get; }
Property Value
Methods
GetAttribLocation(string)
Returns the location of the vertex attribute called name.
int GetAttribLocation(string name)
Parameters
namestring
Returns
GetUniformLocation(string)
Returns the location of the uniform called name.
int GetUniformLocation(string name)
Parameters
namestring
Returns
SetColor(string, Color)
Sets the colour uniform called name to color.
void SetColor(string name, Color color)
Parameters
SetFloat(string, float)
Sets the float uniform called name.
void SetFloat(string name, float value)
Parameters
SetInt(string, int)
Sets the int uniform called name.
void SetInt(string name, int value)
Parameters
SetMatrix4(string, Matrix4x4)
Sets the mat4 uniform called name.
void SetMatrix4(string name, Matrix4x4 matrix)
Parameters
SetVector2(string, Vector2)
Sets the vec2 uniform called name.
void SetVector2(string name, Vector2 value)
Parameters
SetVector3(string, Vector3)
Sets the vec3 uniform called name.
void SetVector3(string name, Vector3 value)
Parameters
SetVector4(string, Vector4)
Sets the vec4 uniform called name.
void SetVector4(string name, Vector4 value)
Parameters
Use()
Makes this the program that later draws use.
void Use()
Verify()
Checks that the program can be used by the active backend. Throws InvalidOperationException when it cannot.
void Verify()
Exceptions
- InvalidOperationException
The program is not valid for the active backend.