OooglesOoogles Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers License |
record TGLShader
Unit
Neslib.Ooogles
Declaration
type TGLShader = record
Description
A vertex or fragment shader
Overview
Methods
Properties
property Handle: GLuint read FHandle; |
Description
Methods
procedure New(const AType: TGLShaderType); overload; inline; |
procedure New(const AType: TGLShaderType; const ASource: RawByteString); overload; inline; |
Creates a shader object.
A shader object is used to maintain the source code that define a shader.
AType indicates the type of shader to be created. Two types of shaders are supported. A shader of type TGLShaderType.Vertex is a shader that is intended to run on the programmable vertex processor. A shader of type TGLShaderType.Fragment is a shader that is intended to run on the programmable fragment processor.
Note: like texture objects, the name space for shader objects may be shared across a set of contexts, as long as the server sides of the contexts share the same address space. If the name space is shared across contexts, any attached objects and the data associated with those attached objects are shared as well.
Note: applications are responsible for providing the synchronization across API calls when objects are accessed from different execution threads.
OpenGL API: glCreateShader
Parameters
- AType
- the type of shader to be created.
- ASource
- (optional) GLSL-ES source code for the shader. When specified, SetSource will be called.
See also
- SetSource
- Set or replace the source code in a shader object.
- GetSource
- Get the source code string from a shader object.
- TGLProgram.AttachShader
- Attach a shader object to the program.
- TGLProgram.DetachShader
- Detach a shader object from a program object.
- Compile
- Compiles the shader;
Note: in DEBUG mode, any compiler warnings will be output to the debug console.
- Delete
- Deletes the shader.
|
procedure Delete; inline; |
Deletes the shader. This frees the memory and invalidates the name associated with the shader object specified by shader. This command effectively undoes the effects of a call to New.
If a shader object to be deleted is attached to a program object, it will be flagged for deletion, but it will not be deleted until it is no longer attached to any program object, for any rendering context (i.e., it must be detached from wherever it was attached before it will be deleted).
To determine whether an object has been flagged for deletion, call IsFlaggedForDeletion.
OpenGL API: glDeleteShader
See also
- New
- TGLProgram.New
- TGLProgram.DetachShader
- Detach a shader object from a program object.
- TGLProgram.Use
- Installs the program object as part of current rendering state.
|
procedure SetSource(const ASource: RawByteString); inline; |
Set or replace the source code in a shader object.
Any source code previously stored in the shader object is completely replaced.
Note: when used with Desktop OpenGL, the source code may be modified to make it compatible with Desktop GLSL.
OpenGL API: glShaderSource
Parameters
- ASource
- the GLSL-ES source code of the shader.
Exceptions raised
TGLError.InvalidOperation
- if a shader compiler is not supported.
See also
- GetSource
- Get the source code string from a shader object.
- Compile
- Compiles the shader;
Note: in DEBUG mode, any compiler warnings will be output to the debug console.
- New
- Delete
- Deletes the shader.
|
function GetSource: RawByteString; inline; |
Get the source code string from a shader object.
OpenGL API: glGetShaderSource
Returns
The shader source code. See also
- SetSource
- Set or replace the source code in a shader object.
- New
|
function Compile: Boolean; |
Compiles the shader;
Note: in DEBUG mode, any compiler warnings will be output to the debug console.
OpenGL API: glCompileShader, glGetShaderInfoLog, glGetShaderiv(GL_COMPILE_STATUS/GL_INFO_LOG_LENGTH)
Returns
In RELEASE mode: True on success, False on failure. In DEBUG mode: True on success or an EGLError exception will be raised on failure. Exceptions raised
TGLError.InvalidOperation
- if a shader compiler is not supported.
- EGLShaderError
- when the source code contains errors and cannot be compiled.
See also
- New
- TGLProgram.Link
- Links the program.
- SetSource
- Set or replace the source code in a shader object.
- TGLShader.ReleaseCompiler.
- Release resources allocated by the shader compiler.
|
function GetType: TGLShaderType; inline; |
Gets the type of the shader.
OpenGL API: glGetShaderiv(GL_SHADER_TYPE)
Returns
The shader type. See also
- New
- Delete
- Deletes the shader.
|
function GetDeleteStatus: Boolean; inline; |
Get the delete status.
OpenGL API: glGetShaderiv(GL_DELETE_STATUS)
Returns
True if the shader is currently flagged for deletion. False otherwise. See also
- New
- Delete
- Deletes the shader.
- Compile
- Compiles the shader;
Note: in DEBUG mode, any compiler warnings will be output to the debug console.
- SetSource
- Set or replace the source code in a shader object.
|
function GetCompileStatus: Boolean; inline; |
Get the compile status.
OpenGL API: glGetShaderiv(GL_COMPILE_STATUS)
Returns
True if the last compile operation was successful. False otherwise. See also
- New
- Delete
- Deletes the shader.
- Compile
- Compiles the shader;
Note: in DEBUG mode, any compiler warnings will be output to the debug console.
- SetSource
- Set or replace the source code in a shader object.
|
class function GetMaxVaryingVectors: Integer; inline; static; |
Get the maximum number four-element floating-point vectors available for interpolating varying variables used by vertex and fragment shaders. Varying variables declared as matrices or arrays will consume multiple interpolators. The value must be at least 8.
OpenGL API: glGetIntegerv(GL_MAX_VARYING_VECTORS)
|
class function GetMaxVertexAttribs: Integer; inline; static; |
Get the maximum number of 4-component generic vertex attributes accessible to a vertex shader. The value must be at least 8.
OpenGL API: glGetIntegerv(GL_MAX_VERTEX_ATTRIBS)
|
class procedure ReleaseCompiler; inline; static; |
Release resources allocated by the shader compiler.
For implementations that support a shader compiler, this method frees resources allocated by the shader compiler. This is a hint from the application that additional shader compilations are unlikely to occur, at least for some period of time, and that the resources consumed by the shader compiler may be released and put to better use elsewhere.
However, if a call to Compile is made after a call to ReleaseCompiler , the shader compiler must be restored to service the compilation request as if ReleaseCompiler had never been called.
OpenGL API: glReleaseShaderCompiler
See also
- Compile
- Compiles the shader;
Note: in DEBUG mode, any compiler warnings will be output to the debug console.
|
Properties
property Handle: GLuint read FHandle; |
OpenGL handle to the shader object.
|
Generated by PasDocEx, based on PasDoc 0.14.0.
|