MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ogl::ShaderProgram Class Reference

Abstraction for OpenGL Shader Programs. More...

#include <shader_program.h>

Public Types

typedef std::shared_ptr< ShaderProgram const > ConstPtr
 
typedef std::shared_ptr< ShaderProgramPtr
 

Public Member Functions

 ~ShaderProgram (void)
 
void bind (void)
 Selects the shader program for rendering.
 
GLint get_attrib_location (char const *name)
 Returns attribute location for the program.
 
GLint get_uniform_location (char const *name)
 Returns the uniform location of the program.
 
void load_frag_code (std::string const &code)
 Load fragment shader from code in memory.
 
void load_frag_file (std::string const &filename)
 Load fragment shader from file.
 
void load_geom_code (std::string const &code)
 Loads optional geometry shader from code in memory.
 
void load_geom_file (std::string const &filename)
 Loads optional geometry shader from file.
 
void load_vert_code (std::string const &code)
 Loads a vertex shader from code in memory.
 
void load_vert_file (std::string const &filename)
 Loads a vertex shader from file.
 
void send_uniform (char const *name, GLfloat val)
 Sends float 'val' to uniform location 'name'.
 
void send_uniform (char const *name, GLint val)
 Sends integer 'val' to uniform location 'name'.
 
void send_uniform (char const *name, math::Matrix4f const &m)
 Sends 4x4-matrx 'm' to uniform location 'name'.
 
void send_uniform (char const *name, math::Vec3f const &v)
 Sends 3-vector 'v' to uniform location 'name'.
 
void send_uniform (char const *name, math::Vec4f const &v)
 Sends 4-vector 'v' to uniform location 'name'.
 
bool try_load_all (std::string const &basename)
 Try loading all shaders by appending ".vert", ".geom" and ".frag" to basename.
 
void unbind (void) const
 Deselects the currend shader program.
 
void unload_frag (void)
 Unloads fragment shader.
 
void unload_geom (void)
 Unloads geometry shader.
 
void unload_vert (void)
 Unloads vertex shader.
 

Static Public Member Functions

static Ptr create (void)
 

Detailed Description

Abstraction for OpenGL Shader Programs.

Definition at line 32 of file shader_program.h.

Member Typedef Documentation

◆ ConstPtr

typedef std::shared_ptr<ShaderProgram const> ogl::ShaderProgram::ConstPtr

Definition at line 36 of file shader_program.h.

◆ Ptr

typedef std::shared_ptr<ShaderProgram> ogl::ShaderProgram::Ptr

Definition at line 35 of file shader_program.h.

Constructor & Destructor Documentation

◆ ~ShaderProgram()

ogl::ShaderProgram::~ShaderProgram ( void  )
inline

Definition at line 138 of file shader_program.h.

Member Function Documentation

◆ bind()

void ogl::ShaderProgram::bind ( void  )
inline

Selects the shader program for rendering.

Definition at line 289 of file shader_program.h.

◆ create()

ShaderProgram::Ptr ogl::ShaderProgram::create ( void  )
inlinestatic

Definition at line 151 of file shader_program.h.

◆ get_attrib_location()

GLint ogl::ShaderProgram::get_attrib_location ( char const *  name)
inline

Returns attribute location for the program.

If the program has not yet been linked, it is linked first. If there is no attribute by that name, -1 is returned.

Definition at line 229 of file shader_program.h.

◆ get_uniform_location()

GLint ogl::ShaderProgram::get_uniform_location ( char const *  name)
inline

Returns the uniform location of the program.

If the program has not yet been linked, it is linked first. If there is no uniform variable by that name, -1 is returned.

Definition at line 236 of file shader_program.h.

◆ load_frag_code()

void ogl::ShaderProgram::load_frag_code ( std::string const &  code)
inline

Load fragment shader from code in memory.

Definition at line 187 of file shader_program.h.

◆ load_frag_file()

void ogl::ShaderProgram::load_frag_file ( std::string const &  filename)
inline

Load fragment shader from file.

Definition at line 169 of file shader_program.h.

◆ load_geom_code()

void ogl::ShaderProgram::load_geom_code ( std::string const &  code)
inline

Loads optional geometry shader from code in memory.

Definition at line 181 of file shader_program.h.

◆ load_geom_file()

void ogl::ShaderProgram::load_geom_file ( std::string const &  filename)
inline

Loads optional geometry shader from file.

Definition at line 163 of file shader_program.h.

◆ load_vert_code()

void ogl::ShaderProgram::load_vert_code ( std::string const &  code)
inline

Loads a vertex shader from code in memory.

Definition at line 175 of file shader_program.h.

◆ load_vert_file()

void ogl::ShaderProgram::load_vert_file ( std::string const &  filename)
inline

Loads a vertex shader from file.

Definition at line 157 of file shader_program.h.

◆ send_uniform() [1/5]

void ogl::ShaderProgram::send_uniform ( char const *  name,
GLfloat  val 
)
inline

Sends float 'val' to uniform location 'name'.

Definition at line 280 of file shader_program.h.

◆ send_uniform() [2/5]

void ogl::ShaderProgram::send_uniform ( char const *  name,
GLint  val 
)
inline

Sends integer 'val' to uniform location 'name'.

Definition at line 271 of file shader_program.h.

◆ send_uniform() [3/5]

void ogl::ShaderProgram::send_uniform ( char const *  name,
math::Matrix4f const &  m 
)
inline

Sends 4x4-matrx 'm' to uniform location 'name'.

Definition at line 262 of file shader_program.h.

◆ send_uniform() [4/5]

void ogl::ShaderProgram::send_uniform ( char const *  name,
math::Vec3f const &  v 
)
inline

Sends 3-vector 'v' to uniform location 'name'.

Definition at line 244 of file shader_program.h.

◆ send_uniform() [5/5]

void ogl::ShaderProgram::send_uniform ( char const *  name,
math::Vec4f const &  v 
)
inline

Sends 4-vector 'v' to uniform location 'name'.

Definition at line 253 of file shader_program.h.

◆ try_load_all()

bool ogl::ShaderProgram::try_load_all ( std::string const &  basename)

Try loading all shaders by appending ".vert", ".geom" and ".frag" to basename.

Definition at line 124 of file shader_program.cc.

◆ unbind()

void ogl::ShaderProgram::unbind ( void  ) const
inline

Deselects the currend shader program.

Definition at line 297 of file shader_program.h.

◆ unload_frag()

void ogl::ShaderProgram::unload_frag ( void  )
inline

Unloads fragment shader.

Definition at line 217 of file shader_program.h.

◆ unload_geom()

void ogl::ShaderProgram::unload_geom ( void  )
inline

Unloads geometry shader.

Definition at line 205 of file shader_program.h.

◆ unload_vert()

void ogl::ShaderProgram::unload_vert ( void  )
inline

Unloads vertex shader.

Definition at line 193 of file shader_program.h.


The documentation for this class was generated from the following files: