Castle Game Engine: CastleGLShaders

# Unit CastleGLShaders
Description | Uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables
## Description OpenGL shaders in GLSL language. Creating/destroying the TGLSLProgram instance immediately creates/destroys appropriate program on GPU. So be sure to create/destroy it only when you have OpenGL context available (for example, create in TCastleWindowCustom.OnOpen and destroy in TCastleWindowCustom.OnClose). Upon creation, we check current OpenGL context abilities. Currently three support levels are possible: no support at all (old OpenGL), support through ARB extensions, or support built-in (newer OpenGL versions, >= 2.0). All three cases are automatically handled inside, so usually you do not have to care about these details. Note that "none" support (on older OpenGL version with no appropriate ARB extensions) means that shaders are not really initialized at all. ## Uses SysUtils Classes GL GLU GLExt CastleGLUtils CastleUtils CastleVectors FGL CastleShaders ## Overview ### Classes, Interfaces, Objects and Records
Name | Description
--- | ---
Class `EGLSLError` | Common class for exceptions related to GLSL programs.
Class `EGLSLShaderCompileError` |
Class `EGLSLProgramLinkError` |
Class `EGLSLRunningInSoftware` |
Class `EGLSLAttributeNotFound` |
Class `EGLSLUniformInvalid` |
Class `EGLSLUniformNotFound` |
Class `EGLSLUniformTypeMismatch` |
Class `TGLSLProgram` | Easily handle program in GLSL (OpenGL Shading Language).
### Functions and Procedures
`function GetCurrentProgram: TGLSLProgram;`
`procedure SetCurrentProgram(const Value: TGLSLProgram);`
### Types
`TGLuintList = TCardinalList;`
`TUniformNotFoundAction = (...);`
`TUniformTypeMismatchAction = (...);`
`TGLSLProgramList = specialize TFPGObjectList<TGLSLProgram>;`
### Variables
`LogShaders: boolean;`
`property CurrentProgram: TGLSLProgram read GetCurrentProgram write SetCurrentProgram;`
## Description ### Functions and Procedures
`function GetCurrentProgram: TGLSLProgram;`
`procedure SetCurrentProgram(const Value: TGLSLProgram);`
### Types
`TGLuintList = TCardinalList;`
`TUniformNotFoundAction = (...);`
What to do when GLSL uniform variable is set (TGLSLProgram.SetUniform) but doesn't exist in the shader. ###### Values uaWarning: Report that uniform variable not found to OnWarning. uaException: Report that uniform variable not found by raising EGLSLUniformNotFound. uaIgnore: Ignore the fact that uniform variable doesn't exist in the GLSL shader. Do not warn anywhere.
`TUniformTypeMismatchAction = (...);`
What to do when GLSL uniform variable is set (by TGLSLProgram.SetUniform) to the type that doesn't match type declared in GLSL shader. ###### Values utGLError: Do not catch uniform type mismatch, leaving it to OpenGL. This will cause OpenGL error "invalid operation" (possibly resulting in an exception in some later code that checks OpenGL errors). This is unsafe (you may get OpenGL errors later), but is also fastest. Other options have to detect invalid types, which means checking the OpenGL error state each time you set uniform value. utWarning: Report type mismatch to OnWarning. utException: Report type mismatch by raising EGLSLUniformTypeMismatch.
`TGLSLProgramList = specialize TFPGObjectList<TGLSLProgram>;`
### Variables
`LogShaders: boolean;`
`property CurrentProgram: TGLSLProgram read GetCurrentProgram write SetCurrentProgram;`
Currently enabled GLSL program. `Nil` if fixed-function pipeline should be used. Setting this property encapsulates the OpenGL glUseProgram (or equivalent ARB extension), additionally preventing redundant glUseProgram calls.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10