Shader Class Reference

#include <shader.h>


Public Member Functions

 Shader ()
 Constructor for the shader class.
 Shader (const char *name)
 Constructor for the shader class.
 ~Shader ()
 Destructor for the shader class.
void Compile (const char *shaderName)
 Compile a shader program.
void UpdateUniforms ()
 Update all uniform variables.
void UpdateUniformsLocation ()
 Update locations for all uniform variables.
void Activate ()
 Activate shader program.
void Deactivate ()
 Deactivate shader program.
void AddUniform (UniVar *uniVar)
 Add uniform variable.
char * Txt2char (const char *fileName)
 Read shader program from file.

Private Attributes

GLuint m_vertex
GLuint m_fragment
GLuint m_program
char * m_name
std::vector< UniVar * > m_uniforms


Constructor & Destructor Documentation

Shader::Shader (  ) 

Constructor for the shader class.

Constructor for the shader class, resets all variables.

Shader::Shader ( const char *  name  ) 

Constructor for the shader class.

Constructor for the shader class, loads and compiles a specified shader.

Parameters:
name Name of the shader program.

Shader::~Shader (  ) 

Destructor for the shader class.

Releases any loaded shaderprogram.


Member Function Documentation

void Shader::Compile ( const char *  shaderName  ) 

Compile a shader program.

Read a vertex and a fragment program from source and compile it.

Parameters:
shaderName Name of the shader program.

void Shader::UpdateUniforms (  ) 

Update all uniform variables.

Update all uniform variables that has been connected to this shader program.

void Shader::UpdateUniformsLocation (  ) 

Update locations for all uniform variables.

Update locations for all uniform variables that has been connected to this shader program.

void Shader::Activate (  ) 

Activate shader program.

Set this proram as the active shader program.

void Shader::Deactivate (  ) 

Deactivate shader program.

Set the active shader program to 0.

void Shader::AddUniform ( UniVar uniVar  ) 

Add uniform variable.

Add a uniform variable to this shader. The added variables will then be updated automaticly by the shader.

char * Shader::Txt2char ( const char *  fileName  ) 

Read shader program from file.

This method opens a file and reads it into a char-buffer.

Parameters:
fileName Filename to read.
Returns:
char-buffer with the file content.


Field Documentation

GLuint Shader::m_vertex [private]

Index of vertex program

GLuint Shader::m_fragment [private]

Index of fragment program

GLuint Shader::m_program [private]

Index of shader program

char* Shader::m_name [private]

Name of the shader

std::vector<UniVar*> Shader::m_uniforms [private]

List of uniform variables


The documentation for this class was generated from the following files:
Generated on Thu May 17 20:28:04 2007 for Ocean View by  doxygen 1.5.2