struct Gloop::Program::Uniforms
- Gloop::Program::Uniforms
- Struct
- Value
- Object
Overview
Access to active uniforms from a program.
Use #at
to reference a uniform by its location.
Use the string variants of #[]
and #[]?
to reference a uniform by its name.
NOTE The uniform index is different than its location. The location is used to get and set a uniform's value. The index is used to retrieve metadata of the uniform.
Included Modules
- Gloop::Contextual
- Gloop::Parameters
- Indexable(Gloop::Uniform)
Defined in:
gloop/program/uniforms.crConstructors
-
.new(context : Context, name : Name)
Creates a references to the active uniforms in a program.
Instance Method Summary
-
#[](name : String) : UniformLocation
References an active uniform from this program by its name.
-
#[]?(name : String) : UniformLocation | Nil
References an active uniform from this program by its name.
-
#at(location : Int32) : UniformLocation
References an active uniform from this program by its location.
-
#locate(name : String) : Int32
Gets the location of a named uniform.
-
#locate!(name : String) : Int32
Gets the location of a named uniform.
-
#locate?(name : String) : Int32 | Nil
Gets the location of a named uniform.
-
#name(index : UInt32) : String
Retrieves the name of the specified uniform.
-
#size
Number of active attributes in the program.
-
#unsafe_fetch(index : Int)
Retrieves a uniform at the specified index.
Constructor Detail
Creates a references to the active uniforms in a program.
Instance Method Detail
References an active uniform from this program by its name.
Raises if there are no uniforms with the specified name.
The location of the uniform is resolved, but not cached. Repeated calls to this method will resolve the location of the uniform by name. It's recommended that the instance returned is kept for repeated use.
- OpenGL function:
glGetUniformLocation
- OpenGL version: 2.0
References an active uniform from this program by its name.
Returns nil if there are no uniforms with the specified name.
The location of the uniform is resolved, but not cached. Repeated calls to this method will resolve the location of the uniform by name. It's recommended that the instance returned is kept for repeated use.
- OpenGL function:
glGetUniformLocation
- OpenGL version: 2.0
References an active uniform from this program by its location.
Gets the location of a named uniform.
Returns -1 if the uniform wasn't found.
- OpenGL function:
glGetUniformLocation
- OpenGL version: 2.0
Gets the location of a named uniform.
Raises an error if the uniform wasn't found.
- OpenGL function:
glGetUniformLocation
- OpenGL version: 2.0
Gets the location of a named uniform.
Returns nil if the uniform wasn't found.
- OpenGL function:
glGetUniformLocation
- OpenGL version: 2.0
Retrieves the name of the specified uniform.
- OpenGL function:
glGetActiveUniformName
- OpenGL version: 3.1
Number of active attributes in the program.
- OpenGL function
glGetProgramiv
- OpenGL enum:
GL_ACTIVE_UNIFORMS
- OpenGL version: 2.0
Retrieves a uniform at the specified index.
- OpenGL function:
glGetActiveUniform
- OpenGL version: 2.0