program¶
- janim.render.program.inject_shader(shader_type: str, shader: str) str¶
- janim.render.program.get_janim_program(filepath: str) Program¶
Given a file path relative to the janim directory, this function automatically traverses the suffixes and reads the shader code. For example, passing
render/shaders/dotcloudwill automatically read the following files:redner/shaders/dotcloud.vert.glsl
render/shaders/dotcloud.geom.glsl
render/shaders/dotcloud.frag.glsl
The entry will be skipped if not available, but a usable shader must still be created
Note:
If the shader program for the given filepath has been created before, it will reuse the existing object; otherwise, it will create a new one and cache it
This method can only load built-in shaders from janim; to load custom shaders, please use
get_custom_program()
- janim.render.program.get_custom_program(filepath: str) Program¶
Given a file path, this function automatically traverses the suffixes and reads the shader code. For example, passing
shaders/yourshaderwill automatically read the following files:shaders/yourshader.vert.glsl
shaders/yourshader.geom.glsl
shaders/yourshader.frag.glsl
The entry will be skipped if not available, but a usable shader must still be created
Note:
If the shader program for the given filepath has been created before, it will reuse the existing object; otherwise, it will create a new one and cache it
This method can only read custom shaders. To read built-in shaders in janim, please use
get_janim_program()
- janim.render.program.get_program_from_string(vertex_shader: str, fragment_shader: str | None = None, geometry_shader: str | None = None, *, cache_key: str | None = None) Program¶
Creates a shader program from shader strings
- janim.render.program.get_janim_compute_shader(filepath: str) ComputeShader¶
Loads a ComputeShader from a file relative to the janim directory. For example, passing
render/shaders/map_points.comp.glslwill load this file from the janim directoryIf the ComputeShader for the given filepath has been created before, it will reuse the existing object; otherwise, it will create a new one and cache it