program.ProgramDescription¶
-
moderngl_window.meta.program.
ProgramDescription
[source]¶ Describes a program to load
By default a program can be loaded in the following ways:
- By supplying a path to s single glsl file containing all shaders
- By supplying several paths to separate files containing each shader trype.
For example
vertex_shader
,fragment_shader
.. etc.
# Single glsl file containing all shaders ProgramDescription(path='programs/myprogram.glsl') # Multiple shader files ProgramDescription( vertex_shader='programs/myprogram_vs.glsl'. fragment_shader='programs/myprogram_fs.glsl'. geometry_shader='programs/myprogram_gs.glsl'. )
Methods¶
-
ProgramDescription.
__init__
(path: str = None, kind: str = None, reloadable=False, vertex_shader: str = None, geometry_shader: str = None, fragment_shader: str = None, tess_control_shader: str = None, tess_evaluation_shader: str = None, **kwargs)[source]¶ Create a program description
Keyword Arguments: - path (str) – path to the resource realive to search directories
- kind (str) – The kind of loader to use
- reloadable (bool) – Should this program be reloadable
- vertex_shader (str) – Path to vertex shader file
- geometry_shader (str) – Path to geometry shader
- fragment_shader (str) – Path to fragmet shader
- tess_control_shader (str) –
- tess_evaluation_shader (str) – Path to tess eval shader
- **kwargs – Optional custom attributes
Attributes¶
-
ProgramDescription.
tess_evaluation_shader
¶ Relative path to tessellation evaluation shader
Type: str
-
ProgramDescription.
vertex_shader
¶ Relative path to vertex shader
Type: str
-
ProgramDescription.
geometry_shader
¶ Relative path to geometry shader
Type: str
-
ProgramDescription.
reloadable
¶ if this program is reloadable
Type: bool
-
ProgramDescription.
fragment_shader
¶ Relative path to fragment shader
Type: str
-
ProgramDescription.
tess_control_shader
¶ Relative path to tess control shader
Type: str
Inherited Attributes¶
-
ProgramDescription.
path
¶ The path to a resource when a single file is specified
Type: str
-
ProgramDescription.
resolved_path
¶ The resolved path by a finder.
The absolute path to the resource can optionally be assigned by a loader class.
Type: pathlib.Path
-
ProgramDescription.
attrs
¶ All keywords arguments passed to the resource
Type: dict
-
ProgramDescription.
label
¶ optional name for the resource
Assigning a label is not mandatory but can help when aliasing resources. Some prefer to preload all needed resources and fetch them later by the label. This can he a lot less chaotic in larger applications.
Type: str
-
ProgramDescription.
kind
¶ default resource kind.
The resource
kind
is directly matched with thekind
in loder classes.This property also supports assignment and is useful if the
kind
is detected based in the the attribute values.description.kind = 'something'
Type: str
-
ProgramDescription.
loader_cls
¶ The loader class for this resource.
This property is assigned to during the loading stage were a loader class is assigned based on the kind.
Type: Type
-
ProgramDescription.
default_kind
= None¶
-
ProgramDescription.
resource_type
= 'programs'¶