modules.render.shader#
- class modules.render.shader.Shader(context, uid: str, templated: bool = False, compute: bool = False)#
Bases:
object- __init__(context, uid: str, templated: bool = False, compute: bool = False)#
Load and parse GLSL shaders from .vert and .frag files
- Parameters:
context (EmberEngine) – This is the main context of the application
uid (str) – The unique idenifier of the shader being initialized
templated (bool) – The version and defines will be set programmatically
- bind_uniforms() None#
Bind the found uniforms to the this shader program
- inject_includes(src: str) str#
- inject_version_and_defines(src: str)#
- load_compute(in_comp: str)#
- load_program(in_vert: str, in_frag: str) int#
Build and create the shader program from .vert and .frag shader
- Parameters:
in_vert (str) – The content of a vertex shader
in_vert – The content of a fragment shader
- Returns:
The index to a valid shader program in GPU memory
- Return type:
int
- load_shader(shader_type: OpenGL.constant.IntConstant, source: str)#
Compile shader from string
- Parameters:
shader_type (OpenGL.constant.IntConstant) – The type of the shader: GL_VERTEX_SHADER or GL_FRAGMENT_SHADER
source (str) – The content of a shader file
- parse_uniforms(shader: str) None#
Dynamicly find and parse uniforms required by the shader
- Parameters:
shader (str) – The content if a GLSL shader as string
- printOpenGLError()#
Print any raised errors during GLSL parsing