#include "Shader.h"
Public Member Functions | |
ShaderProgram () | |
Constructor. | |
~ShaderProgram () | |
De-constructor. | |
bool | Load (const char *vertexFile, const char *pixelFile) |
Loads a complete shader program. | |
bool | LoadFromMemory (const char *vertexSrc, const char *pixelSrc) |
Loads a complete shader program from memory. | |
void | Attach () |
Enables the shader program. | |
void | Detach () |
Disables the shader program. | |
void | SetTexture (GLuint texID, const char *name) |
Attaches a texture to the specified texture attribute. | |
void | SetVector (float x, float y, float z, const char *name) |
Sets a 3D vector shader constant. | |
void | SetFloat (float val, const char *name) |
Sets a single float shader constant. | |
VertexShader & | GetVertexShader () |
PixelShader & | GetPixelShader () |
Protected Member Functions | |
bool | CreateShaderProgram () |
Links the load pixel and vertex shader together. |
Definition at line 108 of file Shader.h.
bool ShaderProgram::Load | ( | const char * | vertexFile, | |
const char * | pixelFile | |||
) |
Loads a complete shader program.
[in] | vertexFile | the filename for the vertex shader. |
[in] | pixelFile | the filename for the pixel shader. |
Definition at line 151 of file Shader.cpp.
References CreateShaderProgram(), PixelShader::Load(), and VertexShader::Load().
bool ShaderProgram::LoadFromMemory | ( | const char * | vertexSrc, | |
const char * | pixelSrc | |||
) |
Loads a complete shader program from memory.
[in] | vertexSrc | the source for the vertex shader. |
[in] | pixelSrc | the source for the pixel shader. |
Definition at line 172 of file Shader.cpp.
References CreateShaderProgram(), PixelShader::LoadFromMemory(), and VertexShader::LoadFromMemory().
void ShaderProgram::SetTexture | ( | GLuint | texID, | |
const char * | name | |||
) |
Attaches a texture to the specified texture attribute.
[in] | texID | the opengl id for the texture. |
[in] | name | the name of the shader attribute. |
Definition at line 241 of file Shader.cpp.
void ShaderProgram::SetVector | ( | float | x, | |
float | y, | |||
float | z, | |||
const char * | name | |||
) |
Sets a 3D vector shader constant.
[in] | x | the x value. |
[in] | y | the y value. |
[in] | z | the z value. |
[in] | name | the name of the shader constant. |
Definition at line 255 of file Shader.cpp.
Referenced by RTVolumeRenderer::SetLightDiffuseColor(), and RTVolumeRenderer::SetLightDirection().
void ShaderProgram::SetFloat | ( | float | val, | |
const char * | name | |||
) |
Sets a single float shader constant.
[in] | val | the value. |
[in] | name | the name of the shader constant. |
Definition at line 269 of file Shader.cpp.
VertexShader& ShaderProgram::GetVertexShader | ( | ) | [inline] |
PixelShader& ShaderProgram::GetPixelShader | ( | ) | [inline] |
bool ShaderProgram::CreateShaderProgram | ( | ) | [protected] |
Links the load pixel and vertex shader together.
Definition at line 194 of file Shader.cpp.
References ErrorMessage(), PixelShader::GetShaderID(), and VertexShader::GetShaderID().
Referenced by Load(), and LoadFromMemory().