#include <CShaders.h>
Inheritance diagram for cGenericShader:

Public Member Functions | |
| cGenericShader () | |
| Constructor of cGenericShader. | |
| virtual | ~cGenericShader () |
| Destructor of cGenericShader. | |
| virtual int | loadVertexShaderFromFile (const char *a_filename) |
| Load a vertex shader from a file. | |
| virtual int | loadFragmentShaderFromFile (const char *a_filename) |
| Load a fragment shader from a file. | |
| virtual int | loadVertexShaderFromText (const char *a_shaderText) |
| Load a vertex shader from a text string. | |
| virtual int | loadFragmentShaderFromText (const char *a_shaderText) |
| Load a fragment shader from a text string. | |
| virtual void | renderSceneGraph (const int a_renderMode=CHAI_RENDER_MODE_RENDER_ALL) |
| Enable the shader before rendering children, then render children, then disable. | |
| virtual void | onDisplayReset (const bool a_affectChildren=true) |
| This function should get called when it's necessary to re-initialize the OpenGL context. | |
| virtual void | setShadingEnabled (const bool a_shadingEnabled) |
| Used to enable and disable shading. | |
| virtual bool | getShadingEnabled () const |
| Is shading currently enabled? | |
Protected Member Functions | |
| virtual void | initializeShaders () |
| Called on display context switches or when new shader text has been loaded. | |
| virtual void | uninitializeShaders () |
| Called when we need to clean up shaders; e.g. when new shaders are being loaded. | |
| virtual int | initializeFragmentShader () |
| Called to create a fragment shader from m_fragmentShaderString. | |
| virtual int | uninitializeFragmentShader () |
| Called to clean up a fragment shader. | |
| virtual int | initializeVertexShader () |
| Called to create a vertex shader from m_vertexShaderString. | |
| virtual int | uninitializeVertexShader () |
| Called to clean up a vertex shader. | |
| virtual void | enableShaders ()=0 |
| Called at the beginning of a rendering pass to enable shaders. | |
| virtual void | disableShaders ()=0 |
Protected Attributes | |
| char * | m_vertexShaderFilename |
| A string representing the vertex shader filename; empty if the shader was initialized from text. | |
| char * | m_vertexShaderString |
| A string representing the vertex shader itself. | |
| char * | m_fragmentShaderFilename |
| A string representing the vertex shader filename; empty if the shader was initialized from text. | |
| char * | m_fragmentShaderString |
| A string representing the vertex shader itself. | |
| bool | m_fragmentShaderInitialized |
| Have we initialized our shaders yet? | |
| bool | m_shadingEnabled |
| Is shading currently enabled? | |
Specific implementations can be found later in this file.
| cGenericShader::cGenericShader | ( | ) |
Constructor of cGenericShader.
Constructor of cGenericShader.
| cGenericShader::~cGenericShader | ( | ) | [virtual] |
Destructor of cGenericShader.
Destructor of cGenericShader.
| int cGenericShader::loadVertexShaderFromFile | ( | const char * | a_filename | ) | [virtual] |
Load a vertex shader from a file.
Users should call this method to load a vertex shader from a file.
| a_filename | The file to load. |
| int cGenericShader::loadFragmentShaderFromFile | ( | const char * | a_filename | ) | [virtual] |
Load a fragment shader from a file.
Users should call this method to load a fragment shader from a file.
| a_filename | The file to load. |
| int cGenericShader::loadVertexShaderFromText | ( | const char * | a_shaderText | ) | [virtual] |
Load a vertex shader from a text string.
Users should call this method to create a vertex shader from a text string.
| a_shaderText | The contents of the shader to create and compile. |
| int cGenericShader::loadFragmentShaderFromText | ( | const char * | a_shaderText | ) | [virtual] |
Load a fragment shader from a text string.
Users should call this method to create a fragment shader from a text string.
| a_shaderText | The contents of the shader to create and compile. |
| void cGenericShader::renderSceneGraph | ( | const int | a_renderMode = CHAI_RENDER_MODE_RENDER_ALL |
) | [virtual] |
Enable the shader before rendering children, then render children, then disable.
Renders the scene graph starting at this object; see cGenericObject.cpp for more details.
This version of the function enables the relevant shader before rendering and disables it afterwards.
| a_renderMode | The current rendering pass; see cGenericObject.cpp |
Reimplemented from cGenericObject.
| void cGenericShader::onDisplayReset | ( | const bool | a_affectChildren = true |
) | [virtual] |
This function should get called when it's necessary to re-initialize the OpenGL context.
Called when the OpenGL context has been re-initialized; see cGenericObject.cpp for details.
This function is responsible for un-initializing and re-initializing shader data.
| a_affectChildren | Should this call be recursively applied to my children? |
Reimplemented from cGenericObject.
| void cGenericShader::initializeShaders | ( | ) | [protected, virtual] |
Called on display context switches or when new shader text has been loaded.
Called to initialize shader data; just calls the initialization methods for vertex and fragment shaders.
| void cGenericShader::uninitializeShaders | ( | ) | [protected, virtual] |
Called when we need to clean up shaders; e.g. when new shaders are being loaded.
Called to clean up shader data; just calls the uninitialization methods for vertex and fragment shaders.
Reimplemented in cGLSLShader.
| virtual void cGenericShader::disableShaders | ( | ) | [protected, pure virtual] |
Called at the end of a rendering pass to disable shaders, must be over-ridden by subclasses
Implemented in cGLSLShader.
1.5.2