Shader

An OpenGL shader.

This is a wrapper around a GLuint created by glCreateShader(type).

Constructors

this
this(ShaderType t)

Create a shader of the specified type.

Destructor

~this
~this()

Destroy the OpenGL Shader and reset the id back to 0.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

compile
void compile()

Try to compile, and throw if it didn't succeed.

compiled
bool compiled()

Check if the Shader is succesfully compiled.

create
void create(ShaderType t)

Create a shader of the specified type.

destroy
void destroy()

Destroy the OpenGL Shader and reset the id back to 0.

load
void load(char[] source_code)

Load the source code for the shader.

log
string log()

The log of errors for when compilation fails.

opCast
bool opCast()

Check if this Shader is already created in OpenGL.

try_compile
void try_compile()

Try to compile the Shader, check compiled() to see if it succeeded.

type
ShaderType type()

The type of this shader.

Properties

created
bool created [@property getter]

Check if this Shader is already created in OpenGL.

id
GLuint id [@property getter]

Ths id of this Shader, or 0 if it is not yet created in OpenGL.

Static functions

fromFile
Shader fromFile(ShaderType t, char[] file_name)

Create, load, and compile a shader directly from a file.

fromSource
Shader fromSource(ShaderType t, char[] source_code)

Create, load, and compile a shader directly from source code.

Meta