sgShader Class Reference

#include <sgShader.h>

Inheritance diagram for sgShader:
sgBase

List of all members.

Public Member Functions

 sgShader ()
 sgShader (const char *vsfilename, const char *fsfilename)
 ~sgShader ()
void destroy ()
BOOL validateProgram ()

Static Public Member Functions

static sgShadergetShader (const char *vsfilename, const char *fsfilename)
static sgShadergetShader (unsigned int shad)

Public Attributes

unsigned int maxlights
GLuint program
unsigned int matproj
unsigned int matview
unsigned int matmodel
unsigned int matnormal
unsigned int mattex
unsigned int position
unsigned int normal
unsigned int texcoord0
unsigned int color
unsigned int mambientloc
unsigned int mdiffuseloc
unsigned int mspecularloc
unsigned int mshininessloc
unsigned int memissiveloc
unsigned int malphatestvalue
unsigned int lambientloc
unsigned int ldiffuseloc
unsigned int lspecularloc
unsigned int lpositionloc
unsigned int lattenuationloc

Detailed Description

Shader class. This class loads, compiles and represents shaders.


Constructor & Destructor Documentation

sgShader::sgShader (  ) 

Constructor. Sets up an instance of this class without a shader.

sgShader::sgShader ( const char *  vsfilename,
const char *  fsfilename 
)

Constructor. Sets up an instance of this class and assigns a shader programm compiled from the given files.

Parameters:
vsfilename name of the textfile containing the vertex shader of the type .vsh, without the type specifier
fsfilename name of the textfile containing the fragment shader of the type .fsh, without the type specifier
sgShader::~sgShader (  ) 

Deconstructor. The deconstructor.


Member Function Documentation

void sgShader::destroy (  )  [virtual]

Create shader. Creates a new shader for the current instance from the given files.

Parameters:
vsfilename name of the textfile containing the vertex shader of the type .vsh, without the type specifier
fsfilename name of the textfile containing the fragment shader of the type .fsh, without the type specifier
Returns:
pointer to the shaders instance

Reimplemented from sgBase.

sgShader * sgShader::getShader ( unsigned int  shad  )  [static]

Get shader. Returns the pointer to an instance of a default shader identified by the given number.

Parameters:
shad id of the default shader to return (0 for no shading, 1 for shading)
Returns:
pointer to the shaders instance
sgShader * sgShader::getShader ( const char *  vsfilename,
const char *  fsfilename 
) [static]

Get shader. Checks, if there is a shader of the given filenames or create a new one otherwize.

Parameters:
vsfilename name of the textfile containing the vertex shader of the type .vsh, without the type specifier
fsfilename name of the textfile containing the fragment shader of the type .fsh, without the type specifier
Returns:
pointer to the shaders instance
BOOL sgShader::validateProgram (  ) 

Validate shader program. Checks if the shader is setup correctly.

Returns:
TRUE if everything is fine, FALSE otherwize

Member Data Documentation

unsigned int sgShader::maxlights

Number of dynamic lights. The number of dynamic lights handled by this shader. Default 2.

Shader program. The id of the OpenGL shader program.


The documentation for this class was generated from the following files:
Generated on Thu Jun 3 13:31:04 2010 for iSDGE by  doxygen 1.6.3