record TGLUniform

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TGLUniform = record

Description

Represents a uniform in a TGLProgram. These are variables marked with uniform in a vertex or fragment shader.

Overview

Methods

procedure Init(const AProgram: TGLProgram; const AUniformName: RawByteString); inline;
procedure SetValue(const AValue: Single); overload; inline;
procedure SetValue(const AValue0, AValue1: Single); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2: Single); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2, AValue3: Single); overload; inline;
procedure SetValue(const AValue: TVector2); overload; inline;
procedure SetValue(const AValue: TVector3); overload; inline;
procedure SetValue(const AValue: TVector4); overload; inline;
procedure SetValue(const AValue: TMatrix2); overload; inline;
procedure SetValue(const AValue: TMatrix3); overload; inline;
procedure SetValue(const AValue: TMatrix4); overload; inline;
procedure SetValue(const AValue: Integer); overload; inline;
procedure SetValue(const AValue0, AValue1: Integer); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2: Integer); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2, AValue3: Integer); overload; inline;
procedure SetValue(const AValue: TIVector2); overload; inline;
procedure SetValue(const AValue: TIVector3); overload; inline;
procedure SetValue(const AValue: TIVector4); overload; inline;
procedure SetValues(const AValues: array of Single); overload;
procedure SetValues(const AValues: TArray<Single>); overload; inline;
procedure SetValues(const AValues: array of TVector2); overload;
procedure SetValues(const AValues: TArray<TVector2>); overload; inline;
procedure SetValues(const AValues: array of TVector3); overload;
procedure SetValues(const AValues: TArray<TVector3>); overload; inline;
procedure SetValues(const AValues: array of TVector4); overload;
procedure SetValues(const AValues: TArray<TVector4>); overload; inline;
procedure SetValues(const AValues: array of Integer); overload;
procedure SetValues(const AValues: TArray<Integer>); overload; inline;
procedure SetValues(const AValues: array of TIVector2); overload;
procedure SetValues(const AValues: TArray<TIVector2>); overload; inline;
procedure SetValues(const AValues: array of TIVector3); overload;
procedure SetValues(const AValues: TArray<TIVector3>); overload; inline;
procedure SetValues(const AValues: array of TIVector4); overload;
procedure SetValues(const AValues: TArray<TIVector4>); overload; inline;
procedure SetValues(const AValues: array of TMatrix2); overload;
procedure SetValues(const AValues: TArray<TMatrix2>); overload; inline;
procedure SetValues(const AValues: array of TMatrix3); overload;
procedure SetValues(const AValues: TArray<TMatrix3>); overload; inline;
procedure SetValues(const AValues: array of TMatrix4); overload;
procedure SetValues(const AValues: TArray<TMatrix4>); overload; inline;
procedure GetValue(out AValue: Single); overload; inline;
procedure GetValue(out AValue0, AValue1: Single); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2: Single); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2, AValue3: Single); overload; inline;
procedure GetValue(out AValue: TVector2); overload; inline;
procedure GetValue(out AValue: TVector3); overload; inline;
procedure GetValue(out AValue: TVector4); overload; inline;
procedure GetValue(out AValue: TMatrix2); overload; inline;
procedure GetValue(out AValue: TMatrix3); overload; inline;
procedure GetValue(out AValue: TMatrix4); overload; inline;
procedure GetValue(out AValue: Integer); overload; inline;
procedure GetValue(out AValue0, AValue1: Integer); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2: Integer); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2, AValue3: Integer); overload; inline;
procedure GetValue(out AValue: TIVector2); overload; inline;
procedure GetValue(out AValue: TIVector3); overload; inline;
procedure GetValue(out AValue: TIVector4); overload; inline;
class function GetMaxVertexUniformVectors: Integer; inline; static;
class function GetMaxFragmentUniformVectors: Integer; inline; static;

Properties

property Location: GLint read FLocation;

Description

Methods

procedure Init(const AProgram: TGLProgram; const AUniformName: RawByteString); inline;

Initializes the uniform.

AUniformName must be an active uniform variable name in program that is not a structure, an array of structures, or a subcomponent of a vector or a matrix.

Uniform variables that are structures or arrays of structures may be queried by using separate TGLUniform records for each field within the structure. The array element operator "[]" and the structure field operator "." may be used in name in order to select elements within an array or fields within a structure. The result of using these operators is not allowed to be another structure, an array of structures, or a subcomponent of a vector or a matrix. Except if the last part of name indicates a uniform variable array, the location of the first element of an array can be retrieved by using the name of the array, or by using the name appended by "[0]".

The actual locations assigned to uniform variables are not known until the program object is linked successfully.

Note: in DEBUG mode, a warning will be logged to the debug console of AProgram does not contain a uniform named AUniformName.

OpenGL API: glGetUniformLocation

Parameters
AProgram
the program containing the uniform.
AUniformName
the (case-sensitive) name of the uniform as used in the vertex or fragment shader of the program.
Exceptions raised
TGLError.InvalidOperation
if AProgram is not a valid program or has not been successfully linked.
See also
SetValue
procedure SetValue(const AValue: Single); overload; inline;
procedure SetValue(const AValue0, AValue1: Single); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2: Single); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2, AValue3: Single); overload; inline;
procedure SetValue(const AValue: TVector2); overload; inline;
procedure SetValue(const AValue: TVector3); overload; inline;
procedure SetValue(const AValue: TVector4); overload; inline;
procedure SetValue(const AValue: TMatrix2); overload; inline;
procedure SetValue(const AValue: TMatrix3); overload; inline;
procedure SetValue(const AValue: TMatrix4); overload; inline;
procedure SetValue(const AValue: Integer); overload; inline;
procedure SetValue(const AValue0, AValue1: Integer); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2: Integer); overload; inline;
procedure SetValue(const AValue0, AValue1, AValue2, AValue3: Integer); overload; inline;
procedure SetValue(const AValue: TIVector2); overload; inline;
procedure SetValue(const AValue: TIVector3); overload; inline;
procedure SetValue(const AValue: TIVector4); overload; inline;

Sets the value of the uniform. There are many overloaded versions for the different data types of the uniform.

When the uniform is a vector, you can set its value by either passing 2, 3 or 4 values, or by passing a single value of type TVector2, TVector3 or TVector4.

This method modifies the value of a uniform variable. It operates on the program object that was made part of current state by calling TGLProgram.Use.

All active uniform variables defined in a program object are initialized to 0 when the program object is linked successfully. They retain the values assigned to them by a call to SetValue until the next successful link operation occurs on the program object, when they are once again initialized to 0.

Note: for sampler uniforms, the value must be of an integer type.

OpenGL API: glUniform*

Exceptions raised
TGLError.InvalidOperation
if there is no current program in use.
TGLError.InvalidOperation
if the number and types of the parameters does not match the declaration in the shader.
TGLError.InvalidOperation
if the uniform is of a sampler type, and the parameter is not of an integer type.
See also
Init
Initializes the uniform.
TGLProgram.Link
Links the program.
TGLProgram.Use
Installs the program object as part of current rendering state.
GetValue
procedure SetValues(const AValues: array of Single); overload;
procedure SetValues(const AValues: TArray<Single>); overload; inline;
procedure SetValues(const AValues: array of TVector2); overload;
procedure SetValues(const AValues: TArray<TVector2>); overload; inline;
procedure SetValues(const AValues: array of TVector3); overload;
procedure SetValues(const AValues: TArray<TVector3>); overload; inline;
procedure SetValues(const AValues: array of TVector4); overload;
procedure SetValues(const AValues: TArray<TVector4>); overload; inline;
procedure SetValues(const AValues: array of Integer); overload;
procedure SetValues(const AValues: TArray<Integer>); overload; inline;
procedure SetValues(const AValues: array of TIVector2); overload;
procedure SetValues(const AValues: TArray<TIVector2>); overload; inline;
procedure SetValues(const AValues: array of TIVector3); overload;
procedure SetValues(const AValues: TArray<TIVector3>); overload; inline;
procedure SetValues(const AValues: array of TIVector4); overload;
procedure SetValues(const AValues: TArray<TIVector4>); overload; inline;
procedure SetValues(const AValues: array of TMatrix2); overload;
procedure SetValues(const AValues: TArray<TMatrix2>); overload; inline;
procedure SetValues(const AValues: array of TMatrix3); overload;
procedure SetValues(const AValues: TArray<TMatrix3>); overload; inline;
procedure SetValues(const AValues: array of TMatrix4); overload;
procedure SetValues(const AValues: TArray<TMatrix4>); overload; inline;

Behaves like SetValue, but operates on a single uniform variable or a uniform variable array.

If AValues contains just a single value, then this method can be used to modify either a single uniform variable or a uniform variable array.

If AValues contains more than one value, then this method can only be used to modify a uniform variable array.

OpenGL API: glUniform*v

See SetValue for more notes and information.

Parameters
AValues
array of values to set.
procedure GetValue(out AValue: Single); overload; inline;
procedure GetValue(out AValue0, AValue1: Single); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2: Single); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2, AValue3: Single); overload; inline;
procedure GetValue(out AValue: TVector2); overload; inline;
procedure GetValue(out AValue: TVector3); overload; inline;
procedure GetValue(out AValue: TVector4); overload; inline;
procedure GetValue(out AValue: TMatrix2); overload; inline;
procedure GetValue(out AValue: TMatrix3); overload; inline;
procedure GetValue(out AValue: TMatrix4); overload; inline;
procedure GetValue(out AValue: Integer); overload; inline;
procedure GetValue(out AValue0, AValue1: Integer); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2: Integer); overload; inline;
procedure GetValue(out AValue0, AValue1, AValue2, AValue3: Integer); overload; inline;
procedure GetValue(out AValue: TIVector2); overload; inline;
procedure GetValue(out AValue: TIVector3); overload; inline;
procedure GetValue(out AValue: TIVector4); overload; inline;

Return the value of a uniform variable.

This method returns in AValue the value of the uniform variable. The type of the uniform variable determines the type of value that is returned. It is the responsibility of the caller to make sure that the type of AValue matches the type of the uniform variable in the shader.

The uniform variable values can only be queried after a link if the link was successful.

OpenGL API: glGetUniform*

Parameters
AValue
is set to the returned value.
Exceptions raised
TGLError.InvalidOperation
if the program is not successfully linked.
See also
Init
Initializes the uniform.
TGLProgram.Link
Links the program.
TGLProgram.Use
Installs the program object as part of current rendering state.
SetValue
class function GetMaxVertexUniformVectors: Integer; inline; static;

Get the maximum number of four-element floating-point, integer, or boolean vectors that can be held in uniform variable storage for a vertex shader. The value must be at least 128.

OpenGL API: glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS)

See also
SetValue
SetValues
GetMaxFragmentUniformVectors
Get the maximum number of four-element floating-point, integer, or boolean vectors that can be held in uniform variable storage for a fragment shader.
class function GetMaxFragmentUniformVectors: Integer; inline; static;

Get the maximum number of four-element floating-point, integer, or boolean vectors that can be held in uniform variable storage for a fragment shader. The value must be at least 16.

OpenGL API: glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS)

See also
SetValue
SetValues
GetMaxVertexUniformVectors
Get the maximum number of four-element floating-point, integer, or boolean vectors that can be held in uniform variable storage for a vertex shader.

Properties

property Location: GLint read FLocation;

The location of this uniform in the program.


Generated by PasDocEx, based on PasDoc 0.14.0.