Shader

class Shader

Implements a GLSL shader handler.

Summary
ShaderImplements a GLSL shader handler.
Functions
ShaderInitializes the object by creating the OpenGL shaders and program.
~ShaderReleases all allocated resources.
BindBinds the shader as the active OpenGL program.
GetAttribLocationReturns the shader attribute location of the given attribute.
GetUniformLocationReturns the shader uniform location of the given uniform.
GetVertexLocationReturns the shader location for the vertex array.
GetColorLocationReturns the shader location for the color array.

Functions

Shader

Shader(const char *sVertexSource,
const char *sFragmentSource)

Initializes the object by creating the OpenGL shaders and program.

Parameters

sVertexSourceSource of the vertex shader as string.
sFragmentSourceSource of the fragment shader as string.

~Shader

~Shader()

Releases all allocated resources.  Also releases all OpenGL resources.

Bind

void Bind() const

Binds the shader as the active OpenGL program.

GetAttribLocation

unsigned int GetAttribLocation(const char *sName) const

Returns the shader attribute location of the given attribute.

Parameters

sNameName of the attribute to be searched.

Returns

The shader attribute location of the given attribute.

GetUniformLocation

unsigned int GetUniformLocation(const char *sName) const

Returns the shader uniform location of the given uniform.

Parameters

sNameName of the uniform to be searched.

Returns

The shader uniform location of the given uniform.

GetVertexLocation

unsigned int GetVertexLocation()

Returns the shader location for the vertex array.

Returns

The shader location for the vertex array.

GetColorLocation

unsigned int GetColorLocation()

Returns the shader location for the color array.

Returns

The shader location for the color array.

class Shader
Implements a GLSL shader handler.
Shader(const char *sVertexSource,
const char *sFragmentSource)
Initializes the object by creating the OpenGL shaders and program.
~Shader()
Releases all allocated resources.
void Bind() const
Binds the shader as the active OpenGL program.
unsigned int GetAttribLocation(const char *sName) const
Returns the shader attribute location of the given attribute.
unsigned int GetUniformLocation(const char *sName) const
Returns the shader uniform location of the given uniform.
unsigned int GetVertexLocation()
Returns the shader location for the vertex array.
unsigned int GetColorLocation()
Returns the shader location for the color array.
Close