Table of Contents

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 GLContext

Gl 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

uint

TraceWarnings

If true shader warning are logged to Debug.WriteLine.

public bool TraceWarnings

Field Value

bool

Properties

ExceptionOnMissingLocation

If set true an exception will generated if setting a non existant uniform. (Default: false).

public bool ExceptionOnMissingLocation { get; set; }

Property Value

bool

FragmentShader

Gl fragment shader id.

public uint FragmentShader { get; }

Property Value

uint

FragmentShaderSource

GLSL source code of the fragment shader.

public string? FragmentShaderSource { get; }

Property Value

string

FriendlyName

Custom friendly name of the shader.

public string FriendlyName { get; }

Property Value

string

GL

Gl api.

public GL GL { get; }

Property Value

GL

GLContext

Gl context.

public GLContext GLContext { get; }

Property Value

GLContext

GeometryShader

Gl geometry shader id.

public uint GeometryShader { get; }

Property Value

uint

GeometryShaderSource

GLSL source code of the geometry shader.

public string? GeometryShaderSource { get; }

Property Value

string

VertexShader

Gl vertex shader id.

public uint VertexShader { get; }

Property Value

uint

VertexShaderSource

GLSL source code of the vertex shader.

public string? VertexShaderSource { get; }

Property Value

string

Methods

GetAttributeLocation(string)

Retrieve the attribute location by the given attribute name.

public uint? GetAttributeLocation(string name)

Parameters

name string

Attribute 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 string

SSBO name.

storageBlockIndex uint

Resulting SSBO block index.

storageBlockBinding uint

Resulting 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 string

Name 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

name string

Uniform variable name.

value bool

Value to set.

SetFloat(string, float)

Set float uniform variable.

public void SetFloat(string name, float value)

Parameters

name string

Uniform variable name.

value float

Value to set.

SetInt(string, int)

Set int uniform variable.

public void SetInt(string name, int value)

Parameters

name string

Uniform variable name.

value int

Value to set.

SetMat4(string, Matrix4x4)

Set Matrix4x4 uniform variable.

public void SetMat4(string name, Matrix4x4 value)

Parameters

name string

Uniform variable name.

value Matrix4x4

Value to set.

SetVec2(string, in Vector2)

Set Vector2 uniform variable.

public void SetVec2(string name, in Vector2 value)

Parameters

name string

Uniform variable name.

value Vector2

Value to set.

SetVec3(string, in Vector3)

Set Vector3 uniform variable.

public void SetVec3(string name, in Vector3 value)

Parameters

name string

Uniform variable name.

value Vector3

Value to set.

SetVec4(string, in Vector4)

Set Vector4 uniform variable.

public void SetVec4(string name, in Vector4 value)

Parameters

name string

Uniform variable name.

value Vector4

Value to set.

Use()

Use the program containing pipeline of shaders configured here.

public void Use()