Record TGLSLAttribute

Unit

Declaration

type TGLSLAttribute = record

Description

 

Overview

Nested Types

Public TLocationOffset = 0..3;

Fields

Public var Owner: TGLSLProgram;
Public Name: string;
Public Location: TGLint;
Public LocationOffsetsToDisable: array [TLocationOffset] of boolean;

Methods

Public procedure EnableArray(LocationOffset: TLocationOffset; Size: TGLint; AType: TGLenum; Normalized: TGLboolean; Stride: TGLsizei; Ptr: PtrUInt);
Public procedure EnableArraySingle(Stride: TGLsizei; Ptr: PtrUInt);
Public procedure EnableArrayVector2(Stride: TGLsizei; Ptr: PtrUInt);
Public procedure EnableArrayVector3(Stride: TGLsizei; Ptr: PtrUInt);
Public procedure EnableArrayVector4(Stride: TGLsizei; Ptr: PtrUInt);
Public procedure EnableArrayMatrix3(Stride: TGLsizei; Ptr: PtrUInt);
Public procedure EnableArrayMatrix4(Stride: TGLsizei; Ptr: PtrUInt);
Public procedure DisableArray;
Public procedure SetValue(const Value: TGLfloat); overload;
Public procedure SetValue(const Value: TVector2); overload;
Public procedure SetValue(const Value: TVector3); overload;
Public procedure SetValue(const Value: TVector4); overload;
Public procedure SetValue(const Value: TMatrix3); overload;
Public procedure SetValue(const Value: TMatrix4); overload;
Public procedure SetValue(const Value: TVector4Integer); overload;
Public procedure SetValue(const Value: TVector4Byte); overload;
Public procedure SetValue(const Value: TGLdouble); overload;

Description

Nested Types

Public TLocationOffset = 0..3;
 

Fields

Public var Owner: TGLSLProgram;
 
Public Name: string;
 
Public Location: TGLint;
 
Public LocationOffsetsToDisable: array [TLocationOffset] of boolean;
 

Methods

Public procedure EnableArray(LocationOffset: TLocationOffset; Size: TGLint; AType: TGLenum; Normalized: TGLboolean; Stride: TGLsizei; Ptr: PtrUInt);

Enable an array of arbitary OpenGL type. See the OpenGL documentation of glVertexAttribPointer for meaning of the parameters.

Note that Ptr is usually an offset relative to the currently bound VBO (Vertex Buffer Object), not a regular pointer to a memory content. That is why is has a type PtrUInt (not Pointer), since usually you calculate it as an integer.

Note that the array size is not specified anywhere. The way you access the array (what indexes you use) determines the minimum count of the array you should have (and uploaded to VBO).

Public procedure EnableArraySingle(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of floats (Single in Pascal).

Public procedure EnableArrayVector2(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TVector2.

Public procedure EnableArrayVector3(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TVector3.

Public procedure EnableArrayVector4(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TVector4.

Public procedure EnableArrayMatrix3(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TMatrix3.

Public procedure EnableArrayMatrix4(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TMatrix4.

Public procedure DisableArray;
 
Public procedure SetValue(const Value: TGLfloat); overload;

Set attribute variable value. The used type must match the type of this variable in GLSL program.

OpenGL forces some constraints on using this, see SetUniform. In short: use this only after linking the program. The program is automatically enabled (set as TGLSLProgram.Current) by this. And note that attributes declared but not actually used in shader code may be eliminated, use DebugInfo to see which attributes are actually used (active in OpenGL terminology).

These should not be often useful. Usually, you should rather load attribute arrays, by EnableArray.

Public procedure SetValue(const Value: TVector2); overload;
 
Public procedure SetValue(const Value: TVector3); overload;
 
Public procedure SetValue(const Value: TVector4); overload;
 
Public procedure SetValue(const Value: TMatrix3); overload;
 
Public procedure SetValue(const Value: TMatrix4); overload;
 
Public procedure SetValue(const Value: TVector4Integer); overload;
 
Public procedure SetValue(const Value: TVector4Byte); overload;
 
Public procedure SetValue(const Value: TGLdouble); overload;
 

Generated by PasDoc 0.15.0.