GLEffect
Description
- Derived from
-
RenderEffect<TParameters> abstract
- Extended by
-
OpenGLEffect abstract
OpenGLESEffect abstract
Full source code is included in the Tinman 3D SDK download. |
Abstract base class for IRenderEffect implementations for OpenGL 4.1 Core Profile and OpenGLES 3.0.
An implementing class must perform the following steps in its constructor:
-
Create render effect passes with RenderEffect.PassCreate.
-
Create shader objects with RenderEffect.ShaderCreate and assign them to render effect passes with RenderEffect.ShaderAssign.
-
Declare vertex attributes with VertexAttributeDeclare. Based on the specified value semantics, vertex attributes will then be mapped to the vertex elements (see VertexElements) of the current geometry buffer (see IGeometryBuffer).
-
Create sampler states with SamplerStateCreate1 and assign them to texture resources with SamplerStateAssign.
If an implementation wants to use low-level parameter slots, the following steps must be performed in the constructor:
-
Declare low-level parameter slots with IRenderEffectParameters.ParameterDeclare, for example by calling RenderEffectParameters.Declare.
Public / Constants
COMP
Shader type index: Compute Shader (GL_COMPUTE_SHADER
)
Compute shaders are not available in OpenGLES 3.0.
- See also
GEOM
Shader type index: Geometry Shader (GL_GEOMETRY_SHADER
)
Geometry shaders are provided by an extension in OpenGLES 3.0.
MESH
Shader type index: Mesh Shader (GL_MESH_SHADER_NV
)
Mesh shaders are provided by a vendor-specific extension.
- See also
TASK
Shader type index: Task Shader (GL_TASK_SHADER_NV
)
Mesh shaders are provided by a vendor-specific extension.
- See also
TESC
Shader type index: Tessellation Control Shader (GL_TESS_CONTROL_SHADER
)
Tessellation shaders are provided by an extension in OpenGLES 3.0.
TESE
Shader type index: Tessellation Evaluation Shader (GL_TESS_EVALUATION_SHADER
)
Tessellation shaders are provided by an extension in OpenGLES 3.0.
Public / Methods
RenderStateDefault
Applies default render state values.
See the documentation of the implementing subclass of GLEffect for details on which default render state values are set, because the set of default render state values is different between GL APIs (e.g. OpenGL 4.1 vs. OpenGLES 3.0).
RenderStateSet
Sets the render state for the current render effect pass.
SamplerStateAssign
Assigns a sampler state to a texture resource.
All vertex attributes must have been declared via VertexAttributeDeclare before a sampler state may be assigned.
- RenderException
-
If a graphics subsystem error has occurred.
SamplerStateCreate
3 overloads
Creates a sampler state (step 1 of 2).
Use the returned sampler object name to configure the sampler state using the GL API and the following helpers:
Then, call SamplerStateCreate3.
- RenderException
-
If sampler state creation has failed.
- See also
Creates a sampler state based on a SamplerStatePreset.
This method first calls SamplerStateCreate1, then SamplerStateDefault and SamplerStateApply, passing preset in. Finally, it calls SamplerStateCreate3 and returns the result.
- RenderException
-
If sampler state creation has failed.
Creates a sampler state (step 2 of 2).
SamplerStateDefault
Applies default sampler state values.
See the documentation of the implementing subclass of GLEffect for details on which default sampler state values are set, because the set of default sampler state values is different between GL APIs (e.g. OpenGL 4.1 vs. OpenGLES 3.0).
- See also
VertexAttributeDeclare
Declares a vertex attribute.
All shader objects must have been created via RenderEffect.ShaderCreate and must have been assigned to passes via RenderEffect.ShaderAssign before a vertex attribute may be declared.
- RenderException
-
If a graphics subsystem error has occurred.
- See also
Protected / Methods
BufferObjectCreate
Creates a buffer object for a uniform block.
- RenderException
-
If buffer creation has failed.
ProgramObjectCreate
Creates a program object for each available render effect pass, attaches all shader objects and links the program.
- RenderException
-
If program creation has failed.
- See also
ProgramObjectReflect
Reflects the active vertex attributes, active uniforms and uniform blocks of the given program object.
An implementing method must perform the following steps, in the order given:
-
For each active vertex attribute, call the ProgramObjectReflectAttribute method once.
-
For each uniform block, call the ProgramObjectReflectUniformBlock method once.
-
For each active uniform, call the ProgramObjectReflectUniform method once.
- RenderException
-
If program reflection has failed.
ProgramObjectReflectAttribute
Declares a program vertex attribute.
- RenderException
-
If the given vertex attribute specification is invalid or unsupported.
- See also
ProgramObjectReflectUniform
Declares a program uniform variable.
- RenderException
-
If the given uniform specification is invalid or unsupported.
- See also
ProgramObjectReflectUniformBlock
Declares a program uniform block.
- RenderException
-
If the given uniform block specification is invalid.
- See also
ProgramObjectUse
Applies the given program in for subsequent use.
The following steps must be performed, in the order given:
-
Activate the given program in by calling
glUseProgram
. -
Apply the uniform block buffers for the given program in, using uniformBlockBinding and uniformBlockGpu.
-
Apply the sampler objects for the given program in, using samplerBinding.
-
Apply the texture units to the uniform variables of the given program in, using uniformTextures.
Protected / Attributes
samplerBinding
Mapping from program object and texture unit to sampler object:
first.X := program object name first.Y := texture unit index second := sampler object name
shaderObjects
Mapping from render effect shader to shader object:
first := render effect shader index second := shader object name
uniformBlockBinding
Mapping from program object and uniform block to uniform block binding:
first.X := program object name first.Y := program-agnostic uniform block index second := uniform block binding point index or -1 if not used.
uniformBlockGpu
Mapping from uniform block to buffer object:
first := program-agnostic uniform block index second := GL buffer object name
uniformSlot
Mapping from render effect parameter to uniform index:
first.X := render effect parameter slot index first.Y := program object name or 0 second := if first.Y is 0: program-agnostic uniform index or -1 if none otherwise: program-specific uniform location or -1 if none
uniformTextures
Mapping from program object and uniform location to associated texture units:
first.X := program object name first.Y := uniform location second := the texture unit index of each uniform element.