picogl.backend.opengl ===================== .. py:module:: picogl.backend.opengl .. autoapi-nested-parse:: gl Backend Interface. This module provides an interface for a gl backend implementation, which offers functionalities for managing OpenGL state, drawing meshes, managing materials, handling client-side arrays, and interacting with textures. Classes: GLBackend: A class defining the interface for the gl backend with various methods for rendering and managing rendering states. Attributes ---------- .. autoapisummary:: picogl.backend.opengl.LegacyPipeline Classes ------- .. autoapisummary:: picogl.backend.opengl.GLBindingStrategy picogl.backend.opengl.LegacyBinding picogl.backend.opengl.ModernBinding picogl.backend.opengl.GLLegacyPipeline picogl.backend.opengl.LegacyPipelineProtocol picogl.backend.opengl.AbstractGLBackend picogl.backend.opengl.GLPipeline Module Contents --------------- .. py:class:: GLBindingStrategy Bases: :py:obj:`abc.ABC` Upload CPU mesh data to a reusable :class:`GPUMesh`. .. py:attribute:: _last_gpu_mesh :type: picogl.backend.geometry.mesh.GPUMesh | None :value: None .. py:method:: upload(mesh: picogl.renderer.meshdata.MeshData) -> picogl.backend.geometry.mesh.GPUMesh :abstractmethod: .. py:method:: bind_mesh(mesh) -> None Deprecated: upload, bind, and remember mesh for the next draw. .. py:method:: draw(mesh, mode) -> None Deprecated: draw the last bound mesh, or upload on demand. .. py:class:: LegacyBinding Bases: :py:obj:`GLBindingStrategy` Upload ``MeshData`` to a client-state :class:`LegacyMesh`. .. py:method:: upload(mesh: picogl.renderer.meshdata.MeshData) -> picogl.backend.geometry.mesh.GPUMesh .. py:class:: ModernBinding Bases: :py:obj:`GLBindingStrategy` Upload ``MeshData`` to a VAO-backed :class:`ModernMesh`. .. py:method:: upload(mesh: picogl.renderer.meshdata.MeshData) -> picogl.backend.geometry.mesh.GPUMesh .. py:method:: upload_gpu_object(mesh: Any) -> picogl.backend.geometry.mesh.GPUMesh Wrap an object that already has ``vao`` / ``ebo`` / ``index_count``. .. py:method:: bind_mesh(mesh) -> None Deprecated: upload, bind, and remember mesh for the next draw. .. py:class:: GLLegacyPipeline Fixed-function matrix, light, and material operations. .. py:method:: set_matrix_mode_model_view() :staticmethod: .. py:method:: set_matrix_mode_projection() :staticmethod: .. py:method:: load_identity() :staticmethod: .. py:method:: set_perspective(fovy, aspect, znear, zfar) :staticmethod: .. py:method:: set_projection(fovy, aspect, znear, zfar) :staticmethod: .. py:method:: translate(x, y, z) :staticmethod: .. py:method:: set_light(position, light=GLLight.LIGHT0) :staticmethod: .. py:method:: set_material(face, material) :staticmethod: .. py:method:: set_color_material(face=GLFace.FRONT_AND_BACK, mode=GLColorMaterialMode.AMBIENT_AND_DIFFUSE) :staticmethod: .. py:method:: set_color(rgba) :staticmethod: .. py:method:: set_uniform_color(color, alpha) .. py:method:: tex_coord2f(coord: picogl.backend.gl.state.texture.TexCoord2f) :staticmethod: .. py:method:: vertex_3f(v1: picogl.backend.gl.state.texture.Vertex3f) :staticmethod: .. py:data:: LegacyPipeline .. py:class:: LegacyPipelineProtocol Bases: :py:obj:`Protocol` Fixed-function and immediate-mode pipeline operations (legacy gl only). .. py:method:: set_matrix_mode_model_view() .. py:method:: set_matrix_mode_projection() .. py:method:: load_identity() .. py:method:: set_perspective(fovy, aspect, znear, zfar) .. py:method:: set_projection(fovy, aspect, znear, zfar) .. py:method:: translate(x, y, z) .. py:method:: set_light(position, light: Any = ...) .. py:method:: set_material(face, material) .. py:method:: set_color_material(face=..., mode=...) .. py:method:: set_color(rgba) .. py:method:: set_uniform_color(color, alpha) .. py:method:: tex_coord2f(coord: picogl.backend.gl.state.texture.TexCoord2f) .. py:method:: vertex_3f(v1: picogl.backend.gl.state.texture.Vertex3f) .. py:class:: AbstractGLBackend Bases: :py:obj:`abc.ABC` ALL rendering must go through this interface. .. py:method:: set_blend(enabled: bool) :abstractmethod: .. py:method:: set_depth_test(enabled: bool) :abstractmethod: .. py:method:: set_depth_write(enabled: bool) :abstractmethod: .. py:method:: set_cull_face(enabled: bool) :abstractmethod: .. py:method:: set_line_width(width: float) :abstractmethod: .. py:method:: set_polygon_mode(*args) :abstractmethod: .. py:method:: set_lighting(enabled: bool) :abstractmethod: .. py:method:: set_uniform_color(color: tuple, alpha: float) :abstractmethod: .. py:method:: draw_elements(mode: int, indices) :abstractmethod: .. py:class:: GLPipeline Bases: :py:obj:`picogl.backend.legacy.core.pipeline.LegacyPipelineProtocol`, :py:obj:`Protocol` Deprecated alias for :class:`LegacyPipelineProtocol`. Do not use for new code. Modern rendering uses :class:`~picogl.backend.modern.core.pipeline.ShaderPipeline`.