Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::ShaderProgramManager Class Reference

#include <StkShaderProgramManager.h>

Classes

struct  ProgramFiles
 

Public Member Functions

void addDirectory (const std::string &path, const std::string &prefix="")
 
std::shared_ptr< ShaderProgramgetShaderProgram (const std::string &name) const
 
std::string getShaderProgramName (const ShaderProgram *program) const
 
std::shared_ptr< ShaderProgramaddShaderProgram (const std::string &name, const std::string &vtx_filename, const std::string &frag_filename, const std::string &geo_filename="")
 
void linkShaders ()
 
void clearShaders ()
 

Protected Attributes

std::list< ProgramFilesshader_files_
 
std::map< std::string, std::shared_ptr< ShaderProgram > > shader_programs_
 

Detailed Description

ShaderProgramManager - Short description. Detailed description.

Member Function Documentation

◆ addDirectory()

void ShaderProgramManager::addDirectory ( const std::string &  path,
const std::string &  prefix = "" 
)

Add a directory of shader files to the manager. This method will scan the given directory for files matching the pattern ShaderName_vtx.glsl, ShaderName_frag.glsl and ShaderName_geo.glsl. These are registered under the name Prefix:ShaderName or just ShaderName if prefix is empty.

◆ addShaderProgram()

std::shared_ptr< ShaderProgram > ShaderProgramManager::addShaderProgram ( const std::string &  name,
const std::string &  vtx_filename,
const std::string &  frag_filename,
const std::string &  geo_filename = "" 
)

Add a shader program entry. This method will register the given shader with the given name, vertex and fragment shader files.

◆ clearShaders()

void ShaderProgramManager::clearShaders ( )

Cleanup all shaders. This should be called before deleting the last OpenGL context.

◆ getShaderProgram()

std::shared_ptr< ShaderProgram > ShaderProgramManager::getShaderProgram ( const std::string &  name) const

Get shader program by name. This method will return the shader program registered on the given name.

◆ getShaderProgramName()

std::string STK::ShaderProgramManager::getShaderProgramName ( const ShaderProgram program) const
inline

Get the registered name of the shader program

◆ linkShaders()

void ShaderProgramManager::linkShaders ( )

Compile and link all shader files. This can be called after registering shader files with addDirectory() or addShaderProgram() to avoid compiling shaders on the first bind() which may cause stuttering in the first frames.

Note
You need a valid OpenGL context before calling this method.

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