program

janim.render.program.get_program_from_file_prefix(filepath_prefix: str) Program

Given a file path relative to the janim directory or the user directory, this function automatically iterates over the suffixes and reads the shader code. For example, passing render/shaders/dotcloud will automatically read the following files:

  • render/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

janim.render.program.get_program_from_files(vertex_shader_file: str, fragment_shader_file: str | None = None, geometry_shader_file: str | None = None) Program

Given specific file paths, read shader code

Note: If the corresponding shader program has been created before, it will reuse the existing object; otherwise, it will create a new one and cache it

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, shader_name: str = '') Program

Creates a shader program from shader strings

Note: You can specify cache_key to provide caching. If a shader program corresponding to cache_key has been created before, it will reuse the previous object

janim.render.program.get_compute_shader_from_file(filepath: str) ComputeShader

Loads a ComputeShader relative to the janim directory or the user directory. For example, passing render/shaders/map_points.comp.glsl will load this file from the janim directory

Note: If the ComputeShader corresponding to filepath has been created before, it will reuse the previous object; otherwise, it will create a new one and cache it