record TGLSLAttribute

DescriptionHierarchyInternal TypesFieldsMethodsProperties

Unit

Declaration

type TGLSLAttribute = record

Description

 

Overview

Internal Types

TLocationOffset = 0..3;

Fields

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

Methods

procedure EnableArray(LocationOffset: TLocationOffset; Size: TGLint; AType: TGLenum; Normalized: TGLboolean; Stride: TGLsizei; Ptr: PtrUInt);
procedure EnableArraySingle(Stride: TGLsizei; Ptr: PtrUInt);
procedure EnableArrayVector2Single(Stride: TGLsizei; Ptr: PtrUInt);
procedure EnableArrayVector3Single(Stride: TGLsizei; Ptr: PtrUInt);
procedure EnableArrayVector4Single(Stride: TGLsizei; Ptr: PtrUInt);
procedure EnableArrayMatrix3Single(Stride: TGLsizei; Ptr: PtrUInt);
procedure EnableArrayMatrix4Single(Stride: TGLsizei; Ptr: PtrUInt);
procedure DisableArray;
procedure SetValue(const Value: TGLfloat);
procedure SetValue(const Value: TVector2Single);
procedure SetValue(const Value: TVector3Single);
procedure SetValue(const Value: TVector4Single);
procedure SetValue(const Value: TMatrix3Single);
procedure SetValue(const Value: TMatrix4Single);
procedure SetValue(const Value: TVector4Integer);
procedure SetValue(const Value: TVector4Byte);
procedure SetValue(const Value: TGLdouble);
procedure SetValue(const Value: TVector2Double);
procedure SetValue(const Value: TVector3Double);
procedure SetValue(const Value: TVector4Double);

Description

Internal Types

TLocationOffset = 0..3;
 

Fields

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

Methods

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).

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

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

procedure EnableArrayVector2Single(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TVector2Single.

procedure EnableArrayVector3Single(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TVector3Single.

procedure EnableArrayVector4Single(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TVector4Single.

procedure EnableArrayMatrix3Single(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TMatrix3Single.

procedure EnableArrayMatrix4Single(Stride: TGLsizei; Ptr: PtrUInt);

Shortcut to enable an array of TMatrix4Single.

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

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 CurrentProgram) 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.

procedure SetValue(const Value: TVector2Single);
 
procedure SetValue(const Value: TVector3Single);
 
procedure SetValue(const Value: TVector4Single);
 
procedure SetValue(const Value: TMatrix3Single);
 
procedure SetValue(const Value: TMatrix4Single);
 
procedure SetValue(const Value: TVector4Integer);
 
procedure SetValue(const Value: TVector4Byte);
 
procedure SetValue(const Value: TGLdouble);
 
procedure SetValue(const Value: TVector2Double);
 
procedure SetValue(const Value: TVector3Double);
 
procedure SetValue(const Value: TVector4Double);
 

Generated by PasDoc 0.14.0.