Class GLPipeline
- Namespace
- SearchAThing.OpenGL.Core
- Assembly
- netcore-opengl-core.dll
Gl pipeline object.
Contains vertex, geometry and fragment shaders where defined and helper method to set uniforms, attributes ans storage blocks.
public class GLPipeline : IGLContextObject
- Inheritance
-
GLPipeline
- Implements
- Inherited Members
Constructors
GLPipeline(GLContext, string?, string?, string?, bool, string)
Create a gl shader.
public GLPipeline(GLContext glContext, string? vertexShaderSource = null, string? geometryShaderSource = null, string? fragmentShaderSource = null, bool exceptionOnMissingLocation = false, string friendlyName = "")
Parameters
glContext
GLContextGl context.
vertexShaderSource
string(Optional) GLSL source code of the vertex shader.
geometryShaderSource
string(Optional) GLSL source code of the geometry shader.
fragmentShaderSource
string(Optional) GLSL source code of the fragment shader.
exceptionOnMissingLocation
bool(Optional) If true an exception will generated if setting a non existant uniform. (Default: false).
friendlyName
string(Optional) Friendly shader name.
Fields
Program
Gl Program id.
public uint Program
Field Value
TraceWarnings
If true shader warning are logged to Debug.WriteLine.
public bool TraceWarnings
Field Value
Properties
ExceptionOnMissingLocation
If set true an exception will generated if setting a non existant uniform. (Default: false).
public bool ExceptionOnMissingLocation { get; set; }
Property Value
FragmentShader
Gl fragment shader id.
public uint FragmentShader { get; }
Property Value
FragmentShaderSource
GLSL source code of the fragment shader.
public string? FragmentShaderSource { get; }
Property Value
FriendlyName
Custom friendly name of the shader.
public string FriendlyName { get; }
Property Value
GL
Gl api.
public GL GL { get; }
Property Value
- GL
GLContext
Gl context.
public GLContext GLContext { get; }
Property Value
GeometryShader
Gl geometry shader id.
public uint GeometryShader { get; }
Property Value
GeometryShaderSource
GLSL source code of the geometry shader.
public string? GeometryShaderSource { get; }
Property Value
VertexShader
Gl vertex shader id.
public uint VertexShader { get; }
Property Value
VertexShaderSource
GLSL source code of the vertex shader.
public string? VertexShaderSource { get; }
Property Value
Methods
GetAttributeLocation(string)
Retrieve the attribute location by the given attribute name.
public uint? GetAttributeLocation(string name)
Parameters
name
stringAttribute name for which retrieve the id.
Returns
- uint?
Id of the attribute.
GetStorageBlockBinding(string, out uint, out uint)
Eetrieve program resource index of given ssbo and retrieve associated binding. a shader unique shared storage binding is auto incremented if no default associated binding found in shader.
public bool GetStorageBlockBinding(string name, out uint storageBlockIndex, out uint storageBlockBinding)
Parameters
name
stringSSBO name.
storageBlockIndex
uintResulting SSBO block index.
storageBlockBinding
uintResulting SSBO block binding.
Returns
- bool
True if SSBO found.
GetUniformLocation(string)
Retrieve the uniform id by the given uniform name.
public uint? GetUniformLocation(string name)
Parameters
name
stringName of the location for which retrieve the id.
Returns
- uint?
Id of the uniform.
SetBool(string, bool)
Set bool uniform variable.
public void SetBool(string name, bool value)
Parameters
SetFloat(string, float)
Set float uniform variable.
public void SetFloat(string name, float value)
Parameters
SetInt(string, int)
Set int uniform variable.
public void SetInt(string name, int value)
Parameters
SetMat4(string, Matrix4x4)
Set Matrix4x4 uniform variable.
public void SetMat4(string name, Matrix4x4 value)
Parameters
SetVec2(string, in Vector2)
Set Vector2 uniform variable.
public void SetVec2(string name, in Vector2 value)
Parameters
SetVec3(string, in Vector3)
Set Vector3 uniform variable.
public void SetVec3(string name, in Vector3 value)
Parameters
SetVec4(string, in Vector4)
Set Vector4 uniform variable.
public void SetVec4(string name, in Vector4 value)
Parameters
Use()
Use the program containing pipeline of shaders configured here.
public void Use()