Program

Program

class arcade.gl.Program(ctx: Context, *, vertex_shader: str, fragment_shader: str = None, geometry_shader: str = None, tess_control_shader: str = None, tess_evaluation_shader: str = None, out_attributes: List[str] = None)[source]

Bases: object

Compiled and linked shader program.

Currently supports vertex, fragment and geometry shaders. Transform feedback also supported when output attributes names are passed in the varyings parameter.

The best way to create a program instance is through arcade.gl.Context.program()

Access Uniforms via the [] operator. Example:

program['MyUniform'] = value
Parameters
  • ctx (Context) – The context this program belongs to

  • vertex_shader (str) – vertex shader source

  • fragment_shader (str) – fragment shader source

  • geometry_shader (str) – geometry shader source

  • tess_control_shader (str) – tessellation control shader source

  • tess_evaluation_shader (str) – tessellation evaluation shader source

  • out_attributes (List[str]) – List of out attributes used in transform feedback.

attribute_key: str

Internal cache key used with vertex arrays

property attributes: Iterable[arcade.gl.types.AttribFormat]

List of attribute information

static compile_shader(source: str, shader_type: ctypes.c_uint) ctypes.c_uint[source]

Compile the shader code of the given type.

shader_type could be GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, …

Returns the shader id as a GLuint

property ctx: Context

The context this program belongs to

Type

arcade.gl.Context

delete()[source]

Destroy the underlying OpenGL resource. Don’t use this unless you know exactly what you are doing.

static delete_glo(ctx, prog_id)[source]
property geometry_input: int

The geometry shader’s input primitive type. This an be compared with GL_TRIANGLES, GL_POINTS etc. and is queried when the program is created.

Type

int

property geometry_output: int

The geometry shader’s output primitive type. This an be compared with GL_TRIANGLES, GL_POINTS etc. and is queried when the program is created.

Type

int

property geometry_vertices: int

The maximum number of vertices that can be emitted. This is queried when the program is created.

Type

int

property glo: int

The OpenGL resource id for this program

Type

int

Link a shader program

property out_attributes: List[str]

Out attributes names used in transform feedback

Type

list of str

use()[source]

Activates the shader. This is normally done for you automatically.

Program Members

Uniform

class arcade.gl.uniform.Uniform(program_id, location, name, data_type, array_length)[source]

Bases: object

A Program uniform

Parameters
  • location (int) – The location of the uniform in the program

  • name (str) – Name of the uniform in the program

  • data_type (gl.GLenum) – The data type of the uniform (GL_FLOAT

property array_length: int

Length of the uniform array. If not an array 1 will be returned

getter
property location: int

The location of the uniform in the program

property name: str

Name of the uniform

setter

UniformBlock

class arcade.gl.uniform.UniformBlock(glo: int, index: int, size: int, name: str)[source]

Bases: object

property binding: int

int: Get or set the binding point for this uniform block

getter()[source]
glo
index
name
setter(value: int)[source]
size