picogl.backend.legacy.core.pipeline

LegacyPipelineProtocol

Attributes

LegacyPipeline

Classes

LegacyPipelineProtocol

Fixed-function and immediate-mode pipeline operations (legacy gl only).

GLLegacyPipeline

Fixed-function matrix, light, and material operations.

Module Contents

class picogl.backend.legacy.core.pipeline.LegacyPipelineProtocol[source]

Bases: Protocol

Fixed-function and immediate-mode pipeline operations (legacy gl only).

set_matrix_mode_model_view()[source]
set_matrix_mode_projection()[source]
load_identity()[source]
set_perspective(fovy, aspect, znear, zfar)[source]
set_projection(fovy, aspect, znear, zfar)[source]
translate(x, y, z)[source]
set_light(position, light: Any = ...)[source]
set_material(face, material)[source]
set_color_material(face=..., mode=...)[source]
set_color(rgba)[source]
set_uniform_color(color, alpha)[source]
tex_coord2f(coord: picogl.backend.gl.state.texture.TexCoord2f)[source]
vertex_3f(v1: picogl.backend.gl.state.texture.Vertex3f)[source]
class picogl.backend.legacy.core.pipeline.GLLegacyPipeline[source]

Fixed-function matrix, light, and material operations.

static set_matrix_mode_model_view()[source]

Sets the current matrix mode to model-view.

This function sets the current OpenGL matrix mode to model-view, allowing subsequent matrix operations to affect the model-view matrix.

@return: None

static set_matrix_mode_projection()[source]

Sets the matrix mode to the default, which is the matrix mode

static load_identity()[source]

Provides a static method to reset the current OpenGL matrix to the identity matrix.

This method is used to simplify transformations by resetting the matrix to a default state, which is the identity matrix. It interacts with the OpenGL graphic library to perform this operation.

@return: None

static set_perspective(fovy: float, aspect: float, znear: float, zfar: float)[source]

set perspective

static set_view(height, width)[source]
static set_projection(fovy: float, aspect: float, znear: float, zfar: float)[source]

set projection

static translate(x: float, y: float, z: float) → None[source]

Translates the current coordinate system by the given x, y, and z amounts.

This method applies a translation transformation to the current coordinate system. The parameters x, y, and z represent the translation distances along the respective axes.

Parameters:
  • x (float) – The distance to translate along the x-axis.

  • y (float) – The distance to translate along the y-axis.

  • z (float) – The distance to translate along the z-axis.

Returns:

None

static set_light(position, light: picogl.backend.gl.state.fill.GLLight = GLLight.LIGHT0) → None[source]

Sets the light source’s position in the OpenGL context.

Sets the specified light source’s position based on the given parameters, allowing configuration of light sources within the OpenGL rendering pipeline.

Parameters:
  • position – The position of the light in 3D space, defined as a list or tuple of four float values (x, y, z, w coordinates).

  • light – The specific light source to be set, defined as an instance of the GLLight enum. Defaults to GLLight.LIGHT0.

Returns:

None

static set_material(face, material: picogl.backend.gl.phong.material.PhongMaterial) → None[source]

Sets the material properties for a specified face using the provided PhongMaterial parameters. This method adjusts the ambient, diffuse, specular, and shininess values for the face in the OpenGL rendering context.

Parameters:
  • face – The specified face of the object to which the material properties are applied.

  • material – An instance of PhongMaterial that encapsulates the ambient, diffuse, specular, and shininess properties to be set for the specified face.

Returns:

None

static set_color_material(face: picogl.backend.gl.state.fill.GLFace = GLFace.FRONT_AND_BACK, mode: picogl.backend.gl.state.fill.GLColorMaterialMode = GLColorMaterialMode.AMBIENT_AND_DIFFUSE) → None[source]

Sets the color material mode for the specified face.

This method sets the material property or combination of properties in the current OpenGL context to track the current color. The specified face and mode determine which material parameters will track the current color.

Parameters:
  • face (GLFace) – Specifies which face(s) of the material to apply the color-material mode to. Default is GLFace.FRONT_AND_BACK.

  • mode (GLColorMaterialMode) – Specifies the color material mode to set. Default is GLColorMaterialMode.AMBIENT_AND_DIFFUSE.

static set_color(rgba: tuple[float, float, float, float]) → None[source]

Sets the current drawing color for subsequent OpenGL rendering.

This method sets the RGBA color using the provided tuple. Each of the four components in the tuple should range between 0.0 and 1.0. The color is applied to all OpenGL primitives that are drawn after calling this method.

Parameters:

rgba (tuple[float, float, float, float]) – A tuple specifying the red, green, blue, and alpha components of the desired color. Each component must be a float within the range [0.0, 1.0].

Returns:

None

static set_rgba_color(rgba_color: picogl.core.rgbcolor.RGBAColor) → None[source]

Sets the RGBA color for the rendering pipeline.

This method updates the color used in the rendering pipeline by providing a new RGBA color and passing it to the legacy OpenGL color setting function.

Parameters:
  • rgba_color (RGBAColor) – A tuple or object representing RGBA color, where

  • R

  • G

  • B

  • [0 (and A are values in the range)

  • 1].

Returns:

None

static tex_coord2f(coord: picogl.backend.gl.state.texture.TexCoord2f) → None[source]

Provides functionality to pass a 2-dimensional texture coordinate to the OpenGL rendering pipeline. This method is a static utility designed to make it convenient to set texture coordinates using a given TexCoord2f object.

Parameters:

coord (TexCoord2f) – A data structure containing the u and v components of the 2D texture coordinate.

Returns:

This method does not return a value.

Return type:

None

Raises:

Any exception raised by the underlying gl_tex_coord2f function call. –

static vertex_3f(v1: picogl.backend.gl.state.texture.Vertex3f)[source]

Provides a static method to process a Vertex3f object and pass its coordinates to a corresponding OpenGL function.

vertex_3f(v1: Vertex3f)[source]

Accepts a Vertex3f object, extracts its x, y, and z coordinates, and sends them to the OpenGL gl_vertex_3f function.

picogl.backend.legacy.core.pipeline.LegacyPipeline[source]