| 
    MRPT
    2.0.4
    
   | 
 
A resource handling helper for OpenGL Shader "programs".
The OpenGL "program" resource will be freed upon destruction or when clear() is called.
#include <mrpt/opengl/Shader.h>
Public Types | |
| using | Ptr = std::shared_ptr< Program > | 
Public Member Functions | |
| Program ()=default | |
| ~Program () | |
| bool | empty () const | 
| void | clear () | 
| Frees the shader program in OpenGL.  More... | |
| bool | linkProgram (std::vector< Shader > &shaders, mrpt::optional_ref< std::string > outErrorMessages=std::nullopt) | 
| Links an OpenGL program with all shader code fragments previously inserted into shaders.  More... | |
| void | declareUniform (const std::string &name) | 
| void | declareAttribute (const std::string &name) | 
| unsigned int | programId () const | 
| int | uniformId (const char *name) const | 
| int | attributeId (const char *name) const | 
| bool | hasUniform (const char *name) const | 
| bool | hasAttribute (const char *name) const | 
| void | dumpProgramDescription (std::ostream &o) const | 
| Prints a textual summary of the program.  More... | |
Private Attributes | |
| std::vector< Shader > | m_shaders | 
| unsigned int | m_program = 0 | 
| std::unordered_map< std::string, int > | m_uniforms | 
| OpenGL Uniforms/attribs defined by the user as inputs/outputs in shader code.  More... | |
| std::unordered_map< std::string, int > | m_attribs | 
      
  | 
  default | 
| Program::~Program | ( | ) | 
Definition at line 85 of file Shader.cpp.
References mrpt::containers::clear().
      
  | 
  inline | 
Definition at line 114 of file Shader.h.
References m_attribs.
Referenced by mrpt::opengl::CRenderizableShaderWireFrame::render(), mrpt::opengl::CRenderizableShaderText::render(), mrpt::opengl::CRenderizableShaderTriangles::render(), and mrpt::opengl::CRenderizableShaderPoints::render().
| void Program::clear | ( | ) | 
Frees the shader program in OpenGL.
Definition at line 87 of file Shader.cpp.
| void Program::declareAttribute | ( | const std::string & | name | ) | 
Definition at line 172 of file Shader.cpp.
References ASSERT_, mrpt::containers::empty(), THROW_EXCEPTION, and THROW_EXCEPTION_FMT.
| void Program::declareUniform | ( | const std::string & | name | ) | 
Definition at line 152 of file Shader.cpp.
References ASSERT_, mrpt::containers::empty(), THROW_EXCEPTION, and THROW_EXCEPTION_FMT.
| void Program::dumpProgramDescription | ( | std::ostream & | o | ) | const | 
Prints a textual summary of the program.
Definition at line 194 of file Shader.cpp.
References ASSERT_, mrpt::containers::empty(), mrpt::format(), and mrpt::math::size().
      
  | 
  inline | 
      
  | 
  inline | 
      
  | 
  inline | 
Definition at line 116 of file Shader.h.
References m_uniforms.
Referenced by mrpt::opengl::processRenderQueue(), and mrpt::opengl::CRenderizableShaderTriangles::render().
| bool Program::linkProgram | ( | std::vector< Shader > & | shaders, | 
| mrpt::optional_ref< std::string > | outErrorMessages = std::nullopt  | 
        ||
| ) | 
Links an OpenGL program with all shader code fragments previously inserted into shaders.
| [in,out] | shaders | The shader code fragments. Will be moved into this Program object, who will become the owner from now on and will eventually free its resources. | 
| [out] | outErrorMessages | If provided, build errors will be saved here. If not, they will dumped to std::cerr | 
Definition at line 109 of file Shader.cpp.
References ASSERT_, mrpt::containers::clear(), and THROW_EXCEPTION.
      
  | 
  inline | 
Definition at line 107 of file Shader.h.
References ASSERT_, and m_program.
Referenced by mrpt::opengl::processRenderQueue().
      
  | 
  inline | 
Definition at line 113 of file Shader.h.
References m_uniforms.
Referenced by mrpt::opengl::processRenderQueue(), mrpt::opengl::CRenderizableShaderTriangles::render(), mrpt::opengl::CRenderizableShaderPoints::render(), and mrpt::opengl::CText::render().
      
  | 
  private | 
Definition at line 136 of file Shader.h.
Referenced by attributeId(), and hasAttribute().
      
  | 
  private | 
Definition at line 130 of file Shader.h.
Referenced by empty(), and programId().
      
  | 
  private | 
      
  | 
  private | 
OpenGL Uniforms/attribs defined by the user as inputs/outputs in shader code.
Definition at line 136 of file Shader.h.
Referenced by hasUniform(), and uniformId().
| Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |