#include <OglShader.h>


Public Member Functions | |
| OglShader () | |
| virtual | ~OglShader () |
| void | initVisual () |
| Initialize the textures, or other graphical resources. | |
| void | init () |
| Initialization method called at graph modification, during bottom-up traversal. | |
| void | reinit () |
| Update method called when variables used in precomputation are modified. | |
| void | drawVisual () |
| Display the VisualModel object. | |
| void | updateVisual () |
| used to update the model if necessary. | |
| void | start () |
| Start the shader. | |
| void | stop () |
| Stop the shader. | |
| void | addDefineMacro (const std::string &name, const std::string &value) |
| void | setTexture (const char *name, unsigned short unit) |
| void | setInt (const char *name, int i) |
| void | setInt2 (const char *name, int i1, int i2) |
| void | setInt3 (const char *name, int i1, int i2, int i3) |
| void | setInt4 (const char *name, int i1, int i2, int i3, int i4) |
| void | setFloat (const char *name, float f1) |
| void | setFloat2 (const char *name, float f1, float f2) |
| void | setFloat3 (const char *name, float f1, float f2, float f3) |
| void | setFloat4 (const char *name, float f1, float f2, float f3, float f4) |
| void | setIntVector (const char *name, int count, const GLint *i) |
| void | setIntVector2 (const char *name, int count, const GLint *i) |
| void | setIntVector3 (const char *name, int count, const GLint *i) |
| void | setIntVector4 (const char *name, int count, const GLint *i) |
| void | setFloatVector (const char *name, int count, const float *f) |
| void | setFloatVector2 (const char *name, int count, const float *f) |
| void | setFloatVector3 (const char *name, int count, const float *f) |
| void | setFloatVector4 (const char *name, int count, const float *f) |
| GLint | getGeometryInputType () |
| void | setGeometryInputType (GLint v) |
| GLint | getGeometryOutputType () |
| void | setGeometryOutputType (GLint v) |
| GLint | getGeometryVerticesOut () |
| void | setGeometryVerticesOut (GLint v) |
Protected Attributes | |
| Data< bool > | turnOn |
| Activates or not the shader in live. | |
| Data< std::string > | vertFilename |
| File where vertex shader is defined. | |
| Data< std::string > | fragFilename |
| File where fragment shader is defined. | |
| Data< std::string > | geoFilename |
| File where geometry shader is defined. | |
| Data< int > | geometryInputType |
| Describes the input type of primitive if geometry shader is used. | |
| Data< int > | geometryOutputType |
| Describes the output type of primitive if geometry shader is used. | |
| Data< int > | geometryVerticesOut |
| Describes the number of vertices in output if geometry shader is used. | |
| sofa::helper::gl::GLSLShader | m_shader |
| OpenGL shader. | |
| bool | hasGeometryShader |
This class is used to implement shader into Sofa, for visual rendering or for special treatement that needs shader mechanism. The 3 kinds of shaders can be defined : vertex, triangle and fragment. Geometry shader is only available with Nvidia's >8 series and Ati's >2K series.
Definition at line 65 of file OglShader.h.
| sofa::component::visualmodel::OglShader::OglShader | ( | ) |
Definition at line 58 of file OglShader.cpp.
| sofa::component::visualmodel::OglShader::~OglShader | ( | ) | [virtual] |
Definition at line 72 of file OglShader.cpp.
References m_shader, sofa::helper::gl::GLSLShader::Release(), and sofa::helper::gl::GLSLShader::TurnOff().
| void sofa::component::visualmodel::OglShader::addDefineMacro | ( | const std::string & | name, | |
| const std::string & | value | |||
| ) |
Definition at line 167 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::AddDefineMacro(), and m_shader.
Referenced by sofa::component::visualmodel::OglShaderDefineMacro::init().
| void sofa::component::visualmodel::OglShader::drawVisual | ( | ) | [virtual] |
Display the VisualModel object.
Reimplemented from sofa::core::VisualModel.
Definition at line 145 of file OglShader.cpp.
| GLint sofa::component::visualmodel::OglShader::getGeometryInputType | ( | ) |
Definition at line 280 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetGeometryInputType(), and m_shader.
| GLint sofa::component::visualmodel::OglShader::getGeometryOutputType | ( | ) |
Definition at line 289 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetGeometryOutputType(), and m_shader.
| GLint sofa::component::visualmodel::OglShader::getGeometryVerticesOut | ( | ) |
Definition at line 298 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetGeometryVerticesOut(), and m_shader.
| void sofa::component::visualmodel::OglShader::init | ( | void | ) | [virtual] |
Initialization method called at graph modification, during bottom-up traversal.
Reimplemented from sofa::core::objectmodel::BaseObject.
Definition at line 78 of file OglShader.cpp.
| void sofa::component::visualmodel::OglShader::initVisual | ( | ) | [virtual] |
Initialize the textures, or other graphical resources.
Called once before the first frame is drawn, and if the graphical context has been recreated.
Reimplemented from sofa::core::VisualModel.
Definition at line 91 of file OglShader.cpp.
References sofa::helper::system::DataRepository, fragFilename, geoFilename, geometryInputType, geometryOutputType, geometryVerticesOut, sofa::core::objectmodel::Data< T >::getValue(), hasGeometryShader, sofa::helper::gl::GLSLShader::InitGLSL(), sofa::helper::gl::GLSLShader::InitShaders(), m_shader, setGeometryInputType(), setGeometryOutputType(), setGeometryVerticesOut(), sofa::core::objectmodel::Data< T >::setValue(), and vertFilename.
| void sofa::component::visualmodel::OglShader::reinit | ( | ) | [virtual] |
Update method called when variables used in precomputation are modified.
Reimplemented from sofa::core::objectmodel::BaseObject.
Definition at line 83 of file OglShader.cpp.
References hasGeometryShader.
| void sofa::component::visualmodel::OglShader::setFloat | ( | const char * | name, | |
| float | f1 | |||
| ) |
Definition at line 204 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloat(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloatVariable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloat2 | ( | const char * | name, | |
| float | f1, | |||
| float | f2 | |||
| ) |
Definition at line 210 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloat2(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloat2Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloat3 | ( | const char * | name, | |
| float | f1, | |||
| float | f2, | |||
| float | f3 | |||
| ) |
Definition at line 216 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloat3(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloat3Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloat4 | ( | const char * | name, | |
| float | f1, | |||
| float | f2, | |||
| float | f3, | |||
| float | f4 | |||
| ) |
Definition at line 222 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloat4(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloat4Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloatVector | ( | const char * | name, | |
| int | count, | |||
| const float * | f | |||
| ) |
Definition at line 254 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloatVector(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloatVectorVariable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloatVector2 | ( | const char * | name, | |
| int | count, | |||
| const float * | f | |||
| ) |
Definition at line 260 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloatVector2(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloatVector2Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloatVector3 | ( | const char * | name, | |
| int | count, | |||
| const float * | f | |||
| ) |
Definition at line 266 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloatVector3(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloatVector3Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setFloatVector4 | ( | const char * | name, | |
| int | count, | |||
| const float * | f | |||
| ) |
Definition at line 272 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetFloatVector4(), start(), and stop().
Referenced by sofa::component::visualmodel::OglFloatVector4Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setGeometryInputType | ( | GLint | v | ) |
Definition at line 284 of file OglShader.cpp.
References m_shader, and sofa::helper::gl::GLSLShader::SetGeometryInputType().
Referenced by initVisual().
| void sofa::component::visualmodel::OglShader::setGeometryOutputType | ( | GLint | v | ) |
Definition at line 293 of file OglShader.cpp.
References m_shader, and sofa::helper::gl::GLSLShader::SetGeometryOutputType().
Referenced by initVisual().
| void sofa::component::visualmodel::OglShader::setGeometryVerticesOut | ( | GLint | v | ) |
Definition at line 303 of file OglShader.cpp.
References m_shader, and sofa::helper::gl::GLSLShader::SetGeometryVerticesOut().
Referenced by initVisual().
| void sofa::component::visualmodel::OglShader::setInt | ( | const char * | name, | |
| int | i | |||
| ) |
Definition at line 178 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetInt(), start(), and stop().
Referenced by sofa::component::visualmodel::OglIntVariable::initVisual().
Definition at line 185 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetInt2(), start(), and stop().
Referenced by sofa::component::visualmodel::OglInt2Variable::initVisual().
Definition at line 191 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetInt3(), start(), and stop().
Referenced by sofa::component::visualmodel::OglInt3Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setInt4 | ( | const char * | name, | |
| int | i1, | |||
| int | i2, | |||
| int | i3, | |||
| int | i4 | |||
| ) |
Definition at line 197 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetInt4(), start(), and stop().
Referenced by sofa::component::visualmodel::OglInt4Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setIntVector | ( | const char * | name, | |
| int | count, | |||
| const GLint * | i | |||
| ) |
Definition at line 229 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetIntVector(), start(), and stop().
Referenced by sofa::component::visualmodel::OglIntVectorVariable::initVisual().
| void sofa::component::visualmodel::OglShader::setIntVector2 | ( | const char * | name, | |
| int | count, | |||
| const GLint * | i | |||
| ) |
Definition at line 235 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetIntVector2(), start(), and stop().
Referenced by sofa::component::visualmodel::OglIntVector2Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setIntVector3 | ( | const char * | name, | |
| int | count, | |||
| const GLint * | i | |||
| ) |
Definition at line 241 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetIntVector3(), start(), and stop().
Referenced by sofa::component::visualmodel::OglIntVector3Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setIntVector4 | ( | const char * | name, | |
| int | count, | |||
| const GLint * | i | |||
| ) |
Definition at line 247 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetIntVector4(), start(), and stop().
Referenced by sofa::component::visualmodel::OglIntVector4Variable::initVisual().
| void sofa::component::visualmodel::OglShader::setTexture | ( | const char * | name, | |
| unsigned short | unit | |||
| ) |
Definition at line 172 of file OglShader.cpp.
References sofa::helper::gl::GLSLShader::GetVariable(), m_shader, sofa::helper::gl::GLSLShader::SetInt(), start(), and stop().
Referenced by sofa::component::visualmodel::OglTexture2D::initVisual().
| void sofa::component::visualmodel::OglShader::start | ( | ) | [virtual] |
Start the shader.
Implements sofa::core::Shader.
Definition at line 156 of file OglShader.cpp.
References sofa::core::objectmodel::Data< T >::getValue(), m_shader, sofa::helper::gl::GLSLShader::TurnOn(), and turnOn.
Referenced by setFloat(), setFloat2(), setFloat3(), setFloat4(), setFloatVector(), setFloatVector2(), setFloatVector3(), setFloatVector4(), setInt(), setInt2(), setInt3(), setInt4(), setIntVector(), setIntVector2(), setIntVector3(), setIntVector4(), and setTexture().
| void sofa::component::visualmodel::OglShader::stop | ( | ) | [virtual] |
Stop the shader.
Implements sofa::core::Shader.
Definition at line 150 of file OglShader.cpp.
References sofa::core::objectmodel::Data< T >::getValue(), m_shader, sofa::helper::gl::GLSLShader::TurnOff(), and turnOn.
Referenced by setFloat(), setFloat2(), setFloat3(), setFloat4(), setFloatVector(), setFloatVector2(), setFloatVector3(), setFloatVector4(), setInt(), setInt2(), setInt3(), setInt4(), setIntVector(), setIntVector2(), setIntVector3(), setIntVector4(), and setTexture().
| void sofa::component::visualmodel::OglShader::updateVisual | ( | ) | [virtual] |
used to update the model if necessary.
Reimplemented from sofa::core::VisualModel.
Definition at line 162 of file OglShader.cpp.
Data<std::string> sofa::component::visualmodel::OglShader::fragFilename [protected] |
File where fragment shader is defined.
Definition at line 73 of file OglShader.h.
Referenced by initVisual().
Data<std::string> sofa::component::visualmodel::OglShader::geoFilename [protected] |
File where geometry shader is defined.
Definition at line 75 of file OglShader.h.
Referenced by initVisual().
Describes the input type of primitive if geometry shader is used.
Definition at line 78 of file OglShader.h.
Referenced by initVisual().
Describes the output type of primitive if geometry shader is used.
Definition at line 80 of file OglShader.h.
Referenced by initVisual().
Describes the number of vertices in output if geometry shader is used.
Definition at line 82 of file OglShader.h.
Referenced by initVisual().
OpenGL shader.
Definition at line 85 of file OglShader.h.
Referenced by addDefineMacro(), getGeometryInputType(), getGeometryOutputType(), getGeometryVerticesOut(), initVisual(), setFloat(), setFloat2(), setFloat3(), setFloat4(), setFloatVector(), setFloatVector2(), setFloatVector3(), setFloatVector4(), setGeometryInputType(), setGeometryOutputType(), setGeometryVerticesOut(), setInt(), setInt2(), setInt3(), setInt4(), setIntVector(), setIntVector2(), setIntVector3(), setIntVector4(), setTexture(), start(), stop(), and ~OglShader().
Data<bool> sofa::component::visualmodel::OglShader::turnOn [protected] |
Data<std::string> sofa::component::visualmodel::OglShader::vertFilename [protected] |
File where vertex shader is defined.
Definition at line 71 of file OglShader.h.
Referenced by initVisual().
1.5.7.1