Shader

Represents an OpenGL program with it's shaders. The constructor must be used to avoid segmentation faults.

class Shader {}

Constructors

this
this(string file)

Loads the shaders directly from a file.

this
this(string filename_, string source)

Loads the shader from the source, filename_ is stored in filename and will be used to identify the shader.

Destructor

~this
~this()
Undocumented in source.

Alias This

program

Alias this to program.

Members

Functions

bind
void bind()

Binds the program.

get_attrib_location
GLint get_attrib_location(string name)

Queries an attrib location from OpenGL and caches it in attrib_locations. If the location was already queried the cache is returned.

get_frag_location
GLint get_frag_location(string name)

Queries an fragment-data location from OpenGL and caches it in frag_locations. If the location was already queried the cache is returned.

get_uniform_location
GLint get_uniform_location(string name)

Queries an uniform location from OpenGL and caches it in uniform_locations. If the location was already queried the cache is returned.

remove
void remove()

Deletes all shaders and the program.

unbind
void unbind()

Unbinds the program.

uniform
void uniform(string name, T value)
void uniform(S name, T value)

If glamour gets compiled with version=gl3n support for vectors, matrices and quaternions is added

uniform
void uniform(S name, T value)
Undocumented in source. Be warned that the author may not have intended to support it.
uniform1f
void uniform1f(string name, float value)
void uniform1f(GLint name, float value)

Sets a shader uniform. Consider the corresponding OpenGL for more information.

uniform1i
void uniform1i(string name, int value)
void uniform1i(GLint name, int value)
uniform2f
void uniform2f(string name, float value1, float value2)
void uniform2f(GLint name, float value1, float value2)
uniform2fv
void uniform2fv(string name, float[] value)
void uniform2fv(GLint name, float[] value)
void uniform2fv(string name, float[] value, int count)
void uniform2fv(GLint name, float[] value, int count)
uniform3fv
void uniform3fv(string name, float[] value)
void uniform3fv(string name, float[] value, int count)
void uniform3fv(GLint name, float[] value, int count)
uniform4fv
void uniform4fv(string name, float[] value)
void uniform4fv(GLint name, float[] value)
void uniform4fv(string name, float[] value, int count)
void uniform4fv(GLint name, float[] value, int count)
uniform_matrix3fv
void uniform_matrix3fv(string name, float[] value, GLboolean transpose)
void uniform_matrix3fv(GLint name, float[] value, GLboolean transpose)
void uniform_matrix3fv(string name, float[] value, GLboolean transpose, int count)
void uniform_matrix3fv(GLint name, float[] value, GLboolean transpose, int count)
uniform_matrix4fv
void uniform_matrix4fv(string name, float[] value, GLboolean transpose)
void uniform_matrix4fv(GLint name, float[] value, GLboolean transpose)
void uniform_matrix4fv(string name, float[] value, GLboolean transpose, int count)
void uniform_matrix4fv(GLint name, float[] value, GLboolean transpose, int count)

Sets a shader uniform. Consider the corresponding OpenGL for more information.

Variables

attrib_locations
GLint[string] attrib_locations;

Attrib locations will be cached here.

directives
string[] directives;

Holds the directives.

filename
string filename;

The shaders filename.

frag_locations
GLint[string] frag_locations;

Frag-data locations will be cached here.

program
GLuint program;

The OpenGL program.

shader_sources
Line[][string] shader_sources;

Holds every shaders source.

uniform_locations
GLint[string] uniform_locations;

Uniform locations will be cached here.

Meta