ShaderProgram

An OpenGL shader program.

This is a wrapper around a GLuint created by glCreateProgram(). Initially, this id is 0. glCreateProgram is automatically called the first time anything is done with the object.

Destructor

~this
~this()

Destroy the OpenGL Vao and reset the id back to 0. (Calls glDeleteProgram.)

Postblit

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

Members

Functions

attach
void attach(Shader shader)

Attach a Shader to this program. (Calls glAttachShader.)

bindAttribute
void bindAttribute(GLuint attribute, const(char)[] name)

Bind an attribute name to a location. (Calls glBindAttribLocation.)

clear
void clear()

destroy() and create().

create
void create()

Force the creation of a OpenGL ShaderProgram, or do nothing if already created. (Calls glCreateProgram.)

destroy
void destroy()

Destroy the OpenGL Vao and reset the id back to 0. (Calls glDeleteProgram.)

link
void link()

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

linked
bool linked()

Check if the ShaderProgram is succesfully linked. (Calls glGetProgramiv with GL_LINK_STATUS.)

log
string log()

The log of errors for when linking fails. (Calls glGetProgramInfoLog.)

opCast
bool opCast()

Check if this ShaderProgram is already created in OpenGL.

tryLink
void tryLink()

Try to link the ShaderProgram, check linked() to see if it succeeded. (Calls glLinkProgram.)

uniform
Uniform!T uniform(const(char)* name)

Look up a uniform variable by its name. (Calls glGetUniformLocation.)

use
void use()

Use this ShaderProgram. (Calls glUseProgram.)

Properties

created
bool created [@property getter]

Check if this ShaderProgram is already created in OpenGL.

id
GLuint id [@property getter]

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

Meta