Class Shader
Basic shader class.
class Shader
: dlib .core .ownership .Owner;
Constructors
| Name | Description |
|---|---|
this
(program, owner)
|
Constructs a shader from a program. |
Fields
| Name | Type | Description |
|---|---|---|
computeSubroutineIndices
|
uint[] | Array of compute shader subroutine indices. |
fragmentSubroutineIndices
|
uint[] | Array of fragment shader subroutine indices. |
parameters
|
dlib | List of shader parameters. |
program
|
BaseShaderProgram | Shader program to use. |
validationEnabled
|
bool | In debug mode, enables or disables shader validation on bind. |
vertexSubroutineIndices
|
uint[] | Array of vertex shader subroutine indices. |
Methods
| Name | Description |
|---|---|
bind
()
|
Binds the underlying shader program. |
bindParameters
(state)
|
Binds all parameters. |
createBlockParameter
(name, length, location)
|
Creates a uniform block parameter of type T.
|
createParameter
(name)
|
Creates a uniform parameter of type T.
|
createParameterArray
(name)
|
Creates a uniform array parameter of type T.
|
createParameterSubroutine
(name, shaderType)
|
Creates a subroutine parameter. |
getParameter
(name)
|
Gets a parameter by name. |
getParameterValue
(name)
|
Gets the value of a parameter by name. |
load
(filename)
|
Loads shader source code from a file, supporting #include directives.
|
setParameter
(name, val)
|
Sets a uniform parameter of type T to a value.
|
setParameterCallback
(name, val)
|
Sets a uniform parameter of type T to a callback.
|
setParameterRef
(name, val)
|
Sets a uniform parameter of type T to a reference.
|
setParameterSubroutine
(name, shaderType, subroutineName)
|
Sets a subroutine parameter with a specific subroutine name. |
unbind
()
|
Unbinds the underlying shader program. |
unbindParameters
(state)
|
Unbinds all parameters. |
validate
()
|
Validates the program. |
Description
Manages a shader program, uniform and subroutine parameters, and provides methods for parameter creation, binding, and validation.