|
| | ShaderCache (std::vector< ShaderType > requested_shaders) |
| |
| | ~ShaderCache () |
| |
| ShaderProgramInfo | get_shader_program (ShaderType type) const |
| |
| void | use_shader_program (ShaderType type) |
| |
| void | stop_using_shader_program () |
| |
| void | register_shader_program (ShaderType type) |
| |
| void | configure_vertex_attributes_for_drawables_vao (GLuint vertex_attribute_object, GLuint vertex_buffer_object, ShaderType type, ShaderVertexAttributeVariable shader_vertex_attribute_variable) |
| | configures a VAO so that it knows how to transmit data from a VBO into the shader program
|
| |
| void | log_shader_program_info () |
| |
| GLVertexAttributeConfiguration | get_gl_vertex_attribute_configuration_for_vertex_attribute_variable (ShaderVertexAttributeVariable shader_vertex_attribute_variable) |
| |
| std::vector< ShaderVertexAttributeVariable > | get_used_vertex_attribute_variables_for_shader (ShaderType type) |
| |
| std::string | get_vertex_attribute_variable_name (ShaderVertexAttributeVariable shader_vertex_attribute_variable) |
| |
| std::string | get_uniform_name (ShaderUniformVariable uniform) |
| |
| GLint | get_uniform_location (ShaderType type, ShaderUniformVariable uniform) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, bool value) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, int value) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, float value) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const glm::vec2 &vec) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, float x, float y) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const glm::vec3 &vec) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, float x, float y, float z) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const glm::vec4 &vec) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const std::vector< glm::vec4 > &values) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, float x, float y, float z, float w) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const glm::mat2 &mat) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const glm::mat3 &mat) |
| |
| void | set_uniform (ShaderType type, ShaderUniformVariable uniform, const glm::mat4 &mat) |
| |
| void | print_out_active_uniforms_in_shader (ShaderType type) |
| |
facilitates simple and robust interaction with shaders
a shader cache is a tool which helps manage shaders in a sane way, firstly the user defines what types of shaders by passing in the requested shaders from the shader catalog, then that shader can be selected easily, it also adheres to the cpp_toolbox standard for naming variables in shader files, this makes it easy to read shader files as when you see a variable you will know exactly what it standard for. With these features it makes it hard to mess up when using shaders
| void ShaderCache::configure_vertex_attributes_for_drawables_vao |
( |
GLuint | vertex_attribute_object, |
|
|
GLuint | vertex_buffer_object, |
|
|
ShaderType | type, |
|
|
ShaderVertexAttributeVariable | shader_vertex_attribute_variable ) |
configures a VAO so that it knows how to transmit data from a VBO into the shader program
- Todo
- make sure that the vertex attribute variable is actually used in the selected shader type
- Note
- this assumes that each vertex attribute data array has its own unique vector for storing (usually a std::vector<glm::vec3>>) [or whatever type of vector]
a good way to think about this is that a shader program has a bunch of incoming conveyor belts, and we need to tell the shader program how big the boxes that are coming in are for each different conveyor belt, then this function is like a conveyor belt configuration, so that we say "BIG_BOXES" and then this function automates setting up the conveyor belt so that the shader program can properly consume those boxes,
With this analogy VAOs are like employees in charge of physical objects, they have different types of objects, say toys, and books which are represented by VBOs they for each type of object, they need to configure how the conveyor belt will operate for each object type (ie, the books can be packed closer than the toys).
This function is then like a "training session" for the employee so that they learn how to configure the conveyor belts, for their own custom objects this is done so that no matter what objects need to be packaged up, the corresponding employee will know how to properly do this.
- Parameters
-
| vertex_attribute_object | the vao that we need to configure the vertex attributes for |
| vertex_buffer_object | the buffer contiaining the vertex attribute data |
| type | the shader we want to do this for |