#include <GLSLShader.h>

Public Member Functions | |
| GLSLShader () | |
| ~GLSLShader () | |
| void | AddHeader (const std::string &header) |
| This builds a header before any shader contents. | |
| void | AddDefineMacro (const std::string &name, const std::string &value) |
| std::string | LoadTextFile (const std::string &strFile) |
| This loads our text file for each shader and returns it in a string. | |
| void | InitShaders (const std::string &strVertex, const std::string &stdGeometry, const std::string &strFragment) |
| This loads a vertex, geometry and fragment shader. | |
| void | InitShaders (const std::string &strVertex, const std::string &strFragment) |
| This loads a vertex and fragment shader. | |
| GLint | GetVariable (std::string strVariable) |
| This returns an ID for a variable in our shader. | |
| void | Release () |
| This releases our memory for our shader. | |
| GLint | GetGeometryInputType () |
| void | SetGeometryInputType (GLint v) |
| GLint | GetGeometryOutputType () |
| void | SetGeometryOutputType (GLint v) |
| GLint | GetGeometryVerticesOut () |
| void | SetGeometryVerticesOut (GLint v) |
| GLhandleARB | GetProgram () |
| These are our basic get functions for our private data. | |
| GLhandleARB | GetVertexS () |
| GLhandleARB | GetGeometryS () |
| GLhandleARB | GetFragmentS () |
| void | SetInt (GLint variable, int newValue) |
| Below are functions to set an integer or a float. | |
| void | SetFloat (GLint variable, float newValue) |
| void | SetInt2 (GLint variable, int i1, int i2) |
| Below are functions to set more than 1 integer or float. | |
| void | SetInt3 (GLint variable, int i1, int i2, int i3) |
| void | SetInt4 (GLint variable, int i1, int i2, int i3, int i4) |
| void | SetFloat2 (GLint variable, float v0, float v1) |
| void | SetFloat3 (GLint variable, float v0, float v1, float v2) |
| void | SetFloat4 (GLint variable, float v0, float v1, float v2, float v3) |
| void | SetIntVector (GLint variable, GLsizei count, const GLint *value) |
| Below are functions to set a vector of integer or float. | |
| void | SetIntVector2 (GLint variable, GLsizei count, const GLint *value) |
| void | SetIntVector3 (GLint variable, GLsizei count, const GLint *value) |
| void | SetIntVector4 (GLint variable, GLsizei count, const GLint *value) |
| void | SetFloatVector (GLint variable, GLsizei count, const float *value) |
| void | SetFloatVector2 (GLint variable, GLsizei count, const float *value) |
| void | SetFloatVector3 (GLint variable, GLsizei count, const float *value) |
| void | SetFloatVector4 (GLint variable, GLsizei count, const float *value) |
| void | TurnOn () |
| These 2 functions turn on and off our shader. | |
| void | TurnOff () |
Static Public Member Functions | |
| static bool | InitGLSL () |
| This is used to load all of the extensions and checks compatibility. | |
Protected Member Functions | |
| bool | CompileShader (GLint target, const std::string &source, GLhandleARB &shader) |
| This function compiles a shader and check the log. | |
Protected Attributes | |
| std::string | header |
| GLhandleARB | m_hVertexShader |
| This handle stores our vertex shader information. | |
| GLhandleARB | m_hGeometryShader |
| This handle stores our geometry shader information. | |
| GLhandleARB | m_hFragmentShader |
| This handle stores our fragment shader information. | |
| GLhandleARB | m_hProgramObject |
| This handle stores our program information which encompasses our shader. | |
| GLint | geometry_input_type |
| GLint | geometry_output_type |
| GLint | geometry_vertices_out |
Definition at line 50 of file GLSLShader.h.
| sofa::helper::gl::GLSLShader::GLSLShader | ( | ) |
Definition at line 70 of file GLSLShader.cpp.
References geometry_input_type, geometry_output_type, geometry_vertices_out, header, m_hFragmentShader, m_hGeometryShader, m_hProgramObject, and m_hVertexShader.
| sofa::helper::gl::GLSLShader::~GLSLShader | ( | ) |
Definition at line 82 of file GLSLShader.cpp.
| void sofa::helper::gl::GLSLShader::AddDefineMacro | ( | const std::string & | name, | |
| const std::string & | value | |||
| ) |
Definition at line 94 of file GLSLShader.cpp.
References AddHeader().
Referenced by sofa::component::visualmodel::OglShader::addDefineMacro().
| void sofa::helper::gl::GLSLShader::AddHeader | ( | const std::string & | header | ) |
This builds a header before any shader contents.
Definition at line 88 of file GLSLShader.cpp.
Referenced by AddDefineMacro().
| bool sofa::helper::gl::GLSLShader::CompileShader | ( | GLint | target, | |
| const std::string & | source, | |||
| GLhandleARB & | shader | |||
| ) | [protected] |
This function compiles a shader and check the log.
Definition at line 126 of file GLSLShader.cpp.
Referenced by InitShaders().
| GLhandleARB sofa::helper::gl::GLSLShader::GetFragmentS | ( | ) | [inline] |
| GLint sofa::helper::gl::GLSLShader::GetGeometryInputType | ( | ) | [inline] |
Definition at line 125 of file GLSLShader.h.
References geometry_input_type.
Referenced by sofa::component::visualmodel::OglShader::getGeometryInputType().
| GLint sofa::helper::gl::GLSLShader::GetGeometryOutputType | ( | ) | [inline] |
Definition at line 128 of file GLSLShader.h.
References geometry_output_type.
Referenced by sofa::component::visualmodel::OglShader::getGeometryOutputType().
| GLhandleARB sofa::helper::gl::GLSLShader::GetGeometryS | ( | ) | [inline] |
| GLint sofa::helper::gl::GLSLShader::GetGeometryVerticesOut | ( | ) | [inline] |
Definition at line 131 of file GLSLShader.h.
References geometry_vertices_out.
Referenced by sofa::component::visualmodel::OglShader::getGeometryVerticesOut().
| GLhandleARB sofa::helper::gl::GLSLShader::GetProgram | ( | ) | [inline] |
These are our basic get functions for our private data.
Definition at line 82 of file GLSLShader.h.
References m_hProgramObject.
| GLint sofa::helper::gl::GLSLShader::GetVariable | ( | std::string | strVariable | ) |
This returns an ID for a variable in our shader.
This function returns a variable ID for a shader variable.
Definition at line 255 of file GLSLShader.cpp.
References m_hProgramObject.
Referenced by sofa::component::visualmodel::OglShader::setFloat(), sofa::component::visualmodel::OglShader::setFloat2(), sofa::component::visualmodel::OglShader::setFloat3(), sofa::component::visualmodel::OglShader::setFloat4(), sofa::component::visualmodel::OglShader::setFloatVector(), sofa::component::visualmodel::OglShader::setFloatVector2(), sofa::component::visualmodel::OglShader::setFloatVector3(), sofa::component::visualmodel::OglShader::setFloatVector4(), sofa::component::visualmodel::OglShader::setInt(), sofa::component::visualmodel::OglShader::setInt2(), sofa::component::visualmodel::OglShader::setInt3(), sofa::component::visualmodel::OglShader::setInt4(), sofa::component::visualmodel::OglShader::setIntVector(), sofa::component::visualmodel::OglShader::setIntVector2(), sofa::component::visualmodel::OglShader::setIntVector3(), sofa::component::visualmodel::OglShader::setIntVector4(), and sofa::component::visualmodel::OglShader::setTexture().
| GLhandleARB sofa::helper::gl::GLSLShader::GetVertexS | ( | ) | [inline] |
| bool sofa::helper::gl::GLSLShader::InitGLSL | ( | ) | [static] |
This is used to load all of the extensions and checks compatibility.
Definition at line 42 of file GLSLShader.cpp.
Referenced by sofa::gui::qt::viewer::qgl::QtGLViewer::init(), sofa::gui::qt::viewer::qt::QtViewer::initializeGL(), sofa::gui::glut::SimpleGUI::initializeGL(), and sofa::component::visualmodel::OglShader::initVisual().
| void sofa::helper::gl::GLSLShader::InitShaders | ( | const std::string & | strVertex, | |
| const std::string & | strFragment | |||
| ) | [inline] |
This loads a vertex and fragment shader.
Definition at line 72 of file GLSLShader.h.
References InitShaders().
| void sofa::helper::gl::GLSLShader::InitShaders | ( | const std::string & | strVertex, | |
| const std::string & | stdGeometry, | |||
| const std::string & | strFragment | |||
| ) |
This loads a vertex, geometry and fragment shader.
This function loads a vertex and fragment shader file.
Definition at line 159 of file GLSLShader.cpp.
References CompileShader(), geometry_input_type, geometry_output_type, geometry_vertices_out, header, LoadTextFile(), m_hFragmentShader, m_hGeometryShader, m_hProgramObject, m_hVertexShader, and Release().
Referenced by InitShaders(), and sofa::component::visualmodel::OglShader::initVisual().
| std::string sofa::helper::gl::GLSLShader::LoadTextFile | ( | const std::string & | strFile | ) |
This loads our text file for each shader and returns it in a string.
This function loads and returns a text file for our shaders.
Definition at line 100 of file GLSLShader.cpp.
Referenced by InitShaders().
| void sofa::helper::gl::GLSLShader::Release | ( | ) |
This releases our memory for our shader.
This function frees all of our shader data.
Definition at line 268 of file GLSLShader.cpp.
References m_hFragmentShader, m_hGeometryShader, m_hProgramObject, and m_hVertexShader.
Referenced by InitShaders(), and sofa::component::visualmodel::OglShader::~OglShader().
| void sofa::helper::gl::GLSLShader::SetFloat | ( | GLint | variable, | |
| float | newValue | |||
| ) |
Definition at line 234 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloat().
| void sofa::helper::gl::GLSLShader::SetFloat2 | ( | GLint | variable, | |
| float | v0, | |||
| float | v1 | |||
| ) |
Definition at line 235 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloat2().
| void sofa::helper::gl::GLSLShader::SetFloat3 | ( | GLint | variable, | |
| float | v0, | |||
| float | v1, | |||
| float | v2 | |||
| ) |
Definition at line 236 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloat3().
| void sofa::helper::gl::GLSLShader::SetFloat4 | ( | GLint | variable, | |
| float | v0, | |||
| float | v1, | |||
| float | v2, | |||
| float | v3 | |||
| ) |
Definition at line 237 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloat4().
| void sofa::helper::gl::GLSLShader::SetFloatVector | ( | GLint | variable, | |
| GLsizei | count, | |||
| const float * | value | |||
| ) |
Definition at line 244 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloatVector().
| void sofa::helper::gl::GLSLShader::SetFloatVector2 | ( | GLint | variable, | |
| GLsizei | count, | |||
| const float * | value | |||
| ) |
Definition at line 245 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloatVector2().
| void sofa::helper::gl::GLSLShader::SetFloatVector3 | ( | GLint | variable, | |
| GLsizei | count, | |||
| const float * | value | |||
| ) |
Definition at line 246 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloatVector3().
| void sofa::helper::gl::GLSLShader::SetFloatVector4 | ( | GLint | variable, | |
| GLsizei | count, | |||
| const float * | value | |||
| ) |
Definition at line 247 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setFloatVector4().
| void sofa::helper::gl::GLSLShader::SetGeometryInputType | ( | GLint | v | ) | [inline] |
Definition at line 126 of file GLSLShader.h.
References geometry_input_type.
Referenced by sofa::component::visualmodel::OglShader::setGeometryInputType().
| void sofa::helper::gl::GLSLShader::SetGeometryOutputType | ( | GLint | v | ) | [inline] |
Definition at line 129 of file GLSLShader.h.
References geometry_output_type.
Referenced by sofa::component::visualmodel::OglShader::setGeometryOutputType().
| void sofa::helper::gl::GLSLShader::SetGeometryVerticesOut | ( | GLint | v | ) | [inline] |
Definition at line 132 of file GLSLShader.h.
References geometry_vertices_out.
Referenced by sofa::component::visualmodel::OglShader::setGeometryVerticesOut().
| void sofa::helper::gl::GLSLShader::SetInt | ( | GLint | variable, | |
| int | newValue | |||
| ) |
Below are functions to set an integer or a float.
Definition at line 230 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setInt(), and sofa::component::visualmodel::OglShader::setTexture().
Below are functions to set more than 1 integer or float.
Definition at line 231 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setInt2().
Definition at line 232 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setInt3().
Definition at line 233 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setInt4().
| void sofa::helper::gl::GLSLShader::SetIntVector | ( | GLint | variable, | |
| GLsizei | count, | |||
| const GLint * | value | |||
| ) |
Below are functions to set a vector of integer or float.
Definition at line 239 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setIntVector().
| void sofa::helper::gl::GLSLShader::SetIntVector2 | ( | GLint | variable, | |
| GLsizei | count, | |||
| const GLint * | value | |||
| ) |
Definition at line 240 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setIntVector2().
| void sofa::helper::gl::GLSLShader::SetIntVector3 | ( | GLint | variable, | |
| GLsizei | count, | |||
| const GLint * | value | |||
| ) |
Definition at line 241 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setIntVector3().
| void sofa::helper::gl::GLSLShader::SetIntVector4 | ( | GLint | variable, | |
| GLsizei | count, | |||
| const GLint * | value | |||
| ) |
Definition at line 242 of file GLSLShader.cpp.
Referenced by sofa::component::visualmodel::OglShader::setIntVector4().
| void sofa::helper::gl::GLSLShader::TurnOff | ( | ) |
Definition at line 252 of file GLSLShader.cpp.
References m_hProgramObject.
Referenced by sofa::component::visualmodel::OglShader::stop(), and sofa::component::visualmodel::OglShader::~OglShader().
| void sofa::helper::gl::GLSLShader::TurnOn | ( | ) |
These 2 functions turn on and off our shader.
Definition at line 251 of file GLSLShader.cpp.
References m_hProgramObject.
Referenced by sofa::component::visualmodel::OglShader::start().
GLint sofa::helper::gl::GLSLShader::geometry_input_type [protected] |
Definition at line 152 of file GLSLShader.h.
Referenced by GetGeometryInputType(), GLSLShader(), InitShaders(), and SetGeometryInputType().
GLint sofa::helper::gl::GLSLShader::geometry_output_type [protected] |
Definition at line 153 of file GLSLShader.h.
Referenced by GetGeometryOutputType(), GLSLShader(), InitShaders(), and SetGeometryOutputType().
GLint sofa::helper::gl::GLSLShader::geometry_vertices_out [protected] |
Definition at line 154 of file GLSLShader.h.
Referenced by GetGeometryVerticesOut(), GLSLShader(), InitShaders(), and SetGeometryVerticesOut().
std::string sofa::helper::gl::GLSLShader::header [protected] |
GLhandleARB sofa::helper::gl::GLSLShader::m_hFragmentShader [protected] |
This handle stores our fragment shader information.
Definition at line 147 of file GLSLShader.h.
Referenced by GetFragmentS(), GLSLShader(), InitShaders(), and Release().
GLhandleARB sofa::helper::gl::GLSLShader::m_hGeometryShader [protected] |
This handle stores our geometry shader information.
Definition at line 144 of file GLSLShader.h.
Referenced by GetGeometryS(), GLSLShader(), InitShaders(), and Release().
GLhandleARB sofa::helper::gl::GLSLShader::m_hProgramObject [protected] |
This handle stores our program information which encompasses our shader.
Definition at line 150 of file GLSLShader.h.
Referenced by GetProgram(), GetVariable(), GLSLShader(), InitShaders(), Release(), TurnOff(), and TurnOn().
GLhandleARB sofa::helper::gl::GLSLShader::m_hVertexShader [protected] |
This handle stores our vertex shader information.
Definition at line 141 of file GLSLShader.h.
Referenced by GetVertexS(), GLSLShader(), InitShaders(), and Release().
1.5.7.1