Diamond
Diamond.Shaders.Program Class Reference

Manages an OpenGL Program object More...

Inheritance diagram for Diamond.Shaders.Program:
Diamond.GLObject

Public Member Functions

bool HasUniform (string name)
 Check if the program has a uniform More...
 
int UniformLocation (string name)
 Get the location of a uniform More...
 
bool HasAttribute (string name)
 Check if the program has an attribute More...
 
int AttributeLocation (string name)
 Get the location of an attribute More...
 
void Use ()
 Use this Program to render. Also updates Program.Current More...
 
override string ToString ()
 
override void Dispose ()
 Delegate Dispose to underlying wrapper class More...
 

Static Public Member Functions

static void UseDefault ()
 Use the default shader to render More...
 
static Program FromShaders (string name, params Shader[] shaders)
 Create a program from compiled shaders More...
 
static Program FromShaders (string name, IEnumerable< Shader >shaders)
 Create a program from compiled shaders More...
 
static Program FromShaders (params Shader[] shaders)
 Create a program from compiled shaders More...
 
static Program FromShaders (IEnumerable< Shader > shaders)
 Create a program from compiled shaders More...
 
static Program FromFiles (params string[] paths)
 Create shaders from glsl source files, and create a program using them. Shader types must be inferrable from file extensions. More...
 

Properties

static Program Current [get]
 The currently active program. Manually invoking glUseProgram will break this. More...
 
- Properties inherited from Diamond.GLObject
string Name [get, protected set]
 Name of this GLObject used for identification More...
 

Additional Inherited Members

- Static Protected Attributes inherited from Diamond.GLObject
static readonly Logger Logger = LogManager.GetLogger(nameof(GLObject))
 Logger for all GLObjects More...
 

Detailed Description

Manages an OpenGL Program object

Member Function Documentation

◆ AttributeLocation()

int Diamond.Shaders.Program.AttributeLocation ( string  name)

Get the location of an attribute

Parameters
nameThe name of the attribute
Returns
The location of the attribute

◆ Dispose()

override void Diamond.Shaders.Program.Dispose ( )
virtual

Delegate Dispose to underlying wrapper class

Implements Diamond.GLObject.

◆ FromFiles()

static Program Diamond.Shaders.Program.FromFiles ( params string []  paths)
static

Create shaders from glsl source files, and create a program using them. Shader types must be inferrable from file extensions.

Parameters
pathsThe glsl source files
Returns
The linked program, or null if initialization faileds

◆ FromShaders() [1/4]

static Program Diamond.Shaders.Program.FromShaders ( string  name,
params Shader []  shaders 
)
static

Create a program from compiled shaders

Parameters
nameThe name of this GLObject
shadersThe shaders to use in this program
Returns
The linked program, or null if initialization failed

◆ FromShaders() [2/4]

static Program Diamond.Shaders.Program.FromShaders ( string  name,
IEnumerable< Shader shaders 
)
static

Create a program from compiled shaders

Parameters
nameThe name of this GLObject
shadersThe shaders to use in this program
Returns
The linked program, or null if initialization failed

◆ FromShaders() [3/4]

static Program Diamond.Shaders.Program.FromShaders ( params Shader []  shaders)
static

Create a program from compiled shaders

Parameters
shadersThe shaders to use in this program
Returns
The linked program, or null if initialization failed

◆ FromShaders() [4/4]

static Program Diamond.Shaders.Program.FromShaders ( IEnumerable< Shader shaders)
static

Create a program from compiled shaders

Parameters
shadersThe shaders to use in this program
Returns
The linked program, or null if initialization failed

◆ HasAttribute()

bool Diamond.Shaders.Program.HasAttribute ( string  name)

Check if the program has an attribute

Parameters
nameThe name of the attribute
Returns
Whether the program has this attribute

◆ HasUniform()

bool Diamond.Shaders.Program.HasUniform ( string  name)

Check if the program has a uniform

Parameters
nameThe name of the uniform
Returns
Whether the program has this uniform

◆ UniformLocation()

int Diamond.Shaders.Program.UniformLocation ( string  name)

Get the location of a uniform

Parameters
nameThe name of the uniform
Returns
The location of the uniform

◆ Use()

void Diamond.Shaders.Program.Use ( )

Use this Program to render. Also updates Program.Current

◆ UseDefault()

static void Diamond.Shaders.Program.UseDefault ( )
static

Use the default shader to render

Property Documentation

◆ Current

Program Diamond.Shaders.Program.Current
staticget

The currently active program. Manually invoking glUseProgram will break this.


The documentation for this class was generated from the following file: