glamour



class  ShaderException: object.Exception;

This exception will be raised when an error occurs while compiling or linking a shader.


string  filename;

The  filename passed to the ctor.


string  process;

The  process passed to the ctor. Will be one of "linking" or "compiling".


this(string infolog, string process_, string filename_ = "<unknown>");

Parameters
string infolog Infolog returned from OpenGL.
string process_ Error occured while linking or compiling?
string filename_ Used to identify the shader.

void  compile_shader(GLuint shader, string filename = "<unknown>");

Compiles an already created OpenGL shader.

Throws
ShaderException on failure.
Parameters
GLuint shader The OpenGL shader.
string filename Used to identify the shader, if an error occurs.

void  link_program(GLuint program, string filename = "<unknown>");

Links an already created OpenGL program.

Throws
ShaderException on failure.
Parameters
GLuint program The OpenGL program.
string filename Used to identify the shader, if an error occurs.

alias  Line = std.typecons.Tuple!(ulong, "line", string, "text").Tuple;

Stores each line of the shader, line and text.


class  Shader;

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


GLuint  program;

The OpenGL  program.


Line[][string]  shader_sources;

Holds every shaders source.


string[]  directives;

Holds the  directives.


string  filename;

The shaders  filename.


GLint[string]  uniform_locations;

Uniform locations will be cached here.


GLint[string]  attrib_locations;

Attrib locations will be cached here.


GLint[string]  frag_locations;

Frag-data locations will be cached here.


this(string file);

Loads the shaders directly from a file.


this(string filename_, string source);

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


void  remove();

Deletes all shaders and the program.


void  bind();

Binds the program.


void  unbind();

Unbinds the program.


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. This throws a ShaderException if OpenGL returns a value < 0 indicating an Error.


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. This throws a ShaderException if OpenGL returns a value < 0 indicating an Error.


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. This throws a ShaderException if OpenGL returns a value < 0 indicating an Error.


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

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


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

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