Shader Class Reference

#include <VisShader.hpp>

List of all members.

Public Member Functions

 Shader (std::string file_name)
void print_fragment_source ()
void print_vertex_source ()
void use ()
void free ()
void print_info ()
void release ()
GLint get_attribute_location (std::string name)
void set_uniform (const char *uniform, GLint value)
void set_uniform (const char *uniform, GLfloat value)
void set_uniform (const char *uniform, const Color4f &color)
void set_uniform (const char *uniform, const V2f &vector)
void set_uniform (const char *uniform, const V3f &vector)
void set_uniform (const char *uniform, const M44f &matrix)
void set_uniform1 (const char *uniform, float *elements, int count)
void set_uniform2 (const char *uniform, float *elements, int count)
void set_uniform3 (const char *uniform, float *elements, int count)
void set_uniform4 (const char *uniform, float *elements, int count)


Detailed Description

A useful GLSL Shader class.

Constructor & Destructor Documentation

Shader::Shader ( std::string  file_name  ) 

Load a shader program from the filesystem.

Parameters:
file_name The path to the shader files without the file suffix. EXAMPLE: file_name="GLSL/myshader" -> "GLSL/myshader.vert" and "GLSL/myshader.frag" will be loaded.


Member Function Documentation

void Shader::free (  ) 

Removes Shader program from OpenGL.

GLint Shader::get_attribute_location ( std::string  name  )  [inline]

Returns the location of a named vertex attribute.

Parameters:
name The name of the attribute.

void Shader::print_fragment_source (  ) 

Prints Fragment shader source to STDOUT.

void Shader::print_info (  )  [inline]

Prints some useful output.

void Shader::print_vertex_source (  ) 

Prints Vertex shader source to STDOUT.

void Shader::release (  )  [inline]

Unbinds shader.

void Shader::set_uniform ( const char *  uniform,
const M44f &  matrix 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform ( const char *  uniform,
const V3f &  vector 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform ( const char *  uniform,
const V2f &  vector 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform ( const char *  uniform,
const Color4f &  color 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform ( const char *  uniform,
GLfloat  value 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform ( const char *  uniform,
GLint  value 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform1 ( const char *  uniform,
float *  elements,
int  count 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform2 ( const char *  uniform,
float *  elements,
int  count 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform3 ( const char *  uniform,
float *  elements,
int  count 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::set_uniform4 ( const char *  uniform,
float *  elements,
int  count 
) [inline]

Sets a uniform variable to a certain value.

Parameters:
uniform The name of the uniform.
value The value.

void Shader::use (  ) 

Binds a shader program.


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

Generated on Wed Dec 10 14:41:01 2008 by  doxygen 1.5.7.1