Diamond
Diamond.Shaders.Shader Class Reference

Manges a OpenGL Shader object More...

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

Public Member Functions

override string ToString ()
 
override void Dispose ()
 Delegate Dispose to underlying wrapper class More...
 

Static Public Member Functions

static Shader FromSource (string source, ShaderType type, string name="Shader")
 Create and compile a shader from glsl source code More...
 
static Shader FromFile (string path, ShaderType type, string name=null)
 Create and compile a shader from a glsl source file More...
 
static Shader FromFile (string path, string name=null)
 Create and compile a shader from a glsl source file. Shader type is inferred from file extension. Extension must be .vs, .vert, .fs, .frag, .gs, or .geom. This can optionally be followed by .glsl or .txt, but the shader type extension must be present. More...
 

Properties

string Source [get]
 The source used to create this shader More...
 
ShaderType Type [get]
 The type of this shader 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

Manges a OpenGL Shader object

Member Function Documentation

◆ Dispose()

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

Delegate Dispose to underlying wrapper class

Implements Diamond.GLObject.

◆ FromFile() [1/2]

static Shader Diamond.Shaders.Shader.FromFile ( string  path,
ShaderType  type,
string  name = null 
)
static

Create and compile a shader from a glsl source file

Parameters
pathThe path to the glsl source file
typeThe type of the shader to create
nameThe name of this GLObject
Returns

◆ FromFile() [2/2]

static Shader Diamond.Shaders.Shader.FromFile ( string  path,
string  name = null 
)
static

Create and compile a shader from a glsl source file. Shader type is inferred from file extension. Extension must be .vs, .vert, .fs, .frag, .gs, or .geom. This can optionally be followed by .glsl or .txt, but the shader type extension must be present.

Parameters
pathThe path to the glsl source file
nameThe name of this GLObject
Returns
The compiled shader, or null if initialization failed or shader type cannot be inferred

◆ FromSource()

static Shader Diamond.Shaders.Shader.FromSource ( string  source,
ShaderType  type,
string  name = "Shader" 
)
static

Create and compile a shader from glsl source code

Parameters
sourceThe glsl source
typeThe type of shader to create
nameThe name of this GLObject
Returns
The compiled Shader, or null if initialization failed

Property Documentation

◆ Source

string Diamond.Shaders.Shader.Source
get

The source used to create this shader

◆ Type

ShaderType Diamond.Shaders.Shader.Type
get

The type of this shader


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