Management of shader programs.
More...
#include <easy3d/renderer/shader_manager.h>
|
static ShaderProgram * | get_program (const std::string &shader_name) |
| Get the shader program if it exists and is working.
|
|
static ShaderProgram * | create_program_from_files (const std::string &file_base_name, const std::vector< ShaderProgram::Attribute > &attributes=std::vector< ShaderProgram::Attribute >(), const std::vector< std::string > &outputs=std::vector< std::string >(), bool geom_shader=false) |
| Create a shader program from shader source files specified by the shader file's base name.
|
|
static ShaderProgram * | create_program_from_files (const std::string &vert_file_name, const std::string &frag_file_name, const std::string &geom_file_name="", const std::string &extra_vert_code="", const std::string &extra_frag_code="", const std::string &extra_geom_code="", const std::vector< ShaderProgram::Attribute > &attributes=std::vector< ShaderProgram::Attribute >(), const std::vector< std::string > &outputs=std::vector< std::string >()) |
| Create a shader program from shader source files specified by individual file names.
|
|
static ShaderProgram * | create_program_from_codes (const std::string &vert_code, const std::string &frag_code, const std::string &geom_code="", const std::vector< ShaderProgram::Attribute > &attributes=std::vector< ShaderProgram::Attribute >(), const std::vector< std::string > &outputs=std::vector< std::string >()) |
| Create a shader program from completed shader source codes.
|
|
static std::vector< ShaderProgram * > | all_programs () |
| Get all shader programs.
|
|
static void | terminate () |
| Destroy all shader programs.
|
|
static void | reload () |
| Reload all shader programs.
|
|
Management of shader programs.
- Note
- Make sure to call terminate() to destroy existing programs before the OpenGL context is deleted.
◆ all_programs()
Get all shader programs.
- Returns
- A vector of all shader programs.
◆ create_program_from_codes()
ShaderProgram * create_program_from_codes |
( |
const std::string & | vert_code, |
|
|
const std::string & | frag_code, |
|
|
const std::string & | geom_code = "", |
|
|
const std::vector< ShaderProgram::Attribute > & | attributes = std::vector<ShaderProgram::Attribute>(), |
|
|
const std::vector< std::string > & | outputs = std::vector<std::string>() ) |
|
static |
Create a shader program from completed shader source codes.
- Parameters
-
vert_code | The vertex shader code. |
frag_code | The fragment shader code. |
geom_code | The geometry shader code (optional). |
attributes | The attributes for the shader program. |
outputs | The outputs for the shader program. |
- Returns
- The created shader program.
◆ create_program_from_files() [1/2]
Create a shader program from shader source files specified by the shader file's base name.
- Parameters
-
file_base_name | The base name of the shader files. |
attributes | The attributes for the shader program. |
outputs | The outputs for the shader program. |
geom_shader | True if a geometry shader is included. |
- Returns
- The created shader program.
- Examples
- Tutorial_203_Viewer_wxWidgets/main.cpp, and Tutorial_204_Viewer_Qt/main.cpp.
◆ create_program_from_files() [2/2]
ShaderProgram * create_program_from_files |
( |
const std::string & | vert_file_name, |
|
|
const std::string & | frag_file_name, |
|
|
const std::string & | geom_file_name = "", |
|
|
const std::string & | extra_vert_code = "", |
|
|
const std::string & | extra_frag_code = "", |
|
|
const std::string & | extra_geom_code = "", |
|
|
const std::vector< ShaderProgram::Attribute > & | attributes = std::vector<ShaderProgram::Attribute>(), |
|
|
const std::vector< std::string > & | outputs = std::vector<std::string>() ) |
|
static |
Create a shader program from shader source files specified by individual file names.
- Parameters
-
vert_file_name | The vertex shader file name. |
frag_file_name | The fragment shader file name. |
geom_file_name | The geometry shader file name (optional). |
extra_vert_code | Extra vertex shader code (optional). |
extra_frag_code | Extra fragment shader code (optional). |
extra_geom_code | Extra geometry shader code (optional). |
attributes | The attributes for the shader program. |
outputs | The outputs for the shader program. |
- Returns
- The created shader program.
◆ get_program()
The documentation for this class was generated from the following files:
- G:/3_code/Easy3D/easy3d/renderer/shader_manager.h
- G:/3_code/Easy3D/easy3d/renderer/shader_manager.cpp