picogl.backend.state ==================== .. py:module:: picogl.backend.state .. autoapi-nested-parse:: Render-state descriptors and command helpers for PicoGL backends. The classes in this module are intentionally backend-neutral: they describe desired OpenGL state and delegate the actual gl calls to a backend object. Classes ------- .. autoapisummary:: picogl.backend.state.RasterState picogl.backend.state.GLStateManager picogl.backend.state.BlendState picogl.backend.state.DepthState picogl.backend.state.RenderState picogl.backend.state.RenderStateApplier picogl.backend.state.GLVertexBuffer picogl.backend.state.GLAttributeArray picogl.backend.state.GLViewport picogl.backend.state.TestGLMesh picogl.backend.state.DrawCommand picogl.backend.state.GLClipPlaneState Functions --------- .. autoapisummary:: picogl.backend.state.gl_value Module Contents --------------- .. py:function:: gl_value(value: Any) -> Any Return a raw OpenGL value for PicoGL enums or pass raw values through. .. py:class:: RasterState Raster State .. py:attribute:: polygon_mode :type: Any .. py:attribute:: line_width :type: float :value: 1.0 .. py:attribute:: polygon_offset :type: tuple[float, float] :value: (0.0, 0.0) .. py:attribute:: point_size :type: float | None :value: None .. py:method:: apply(backend: Any) -> None .. py:class:: GLStateManager(backend: CapabilityDriver) Tracks capability state without querying OpenGL. .. py:attribute:: backend .. py:attribute:: _caps :type: dict[int, bool] .. py:method:: set_enabled(cap: int, enabled: bool) -> None .. py:method:: is_enabled(cap: int) -> bool .. py:class:: BlendState Blend State .. py:attribute:: enabled :type: bool :value: False .. py:attribute:: src :type: Any .. py:attribute:: dst :type: Any .. py:method:: apply(state: GLStateManager) .. py:class:: DepthState(test: bool = True, write: bool = True, enabled: bool | None = None) Depth State .. py:attribute:: test :type: bool :value: True .. py:attribute:: write :type: bool :value: True .. py:property:: enabled :type: bool .. py:method:: apply(state: GLStateManager) .. py:class:: RenderState(*, raster: RasterState | None = None, depth: DepthState | None = None, blend: BlendState | bool | None = None, blend_src: Any = GLBlendFactor.SRC_ALPHA, blend_dst: Any = GLBlendFactor.ONE_MINUS_SRC_ALPHA, depth_test: bool | None = None, depth_write: bool | None = None, line_width: float | None = None, polygon_mode: Any | None = None, polygon_offset: tuple[float, float] | None = None, point_size: float | None = None, program_point_size: bool = False, cull_face: bool = False, lighting: bool = False) Flat render-state descriptor with nested-state constructor support. .. py:attribute:: blend :type: bool :value: False .. py:attribute:: blend_src :type: Any .. py:attribute:: blend_dst :type: Any .. py:attribute:: depth_test :type: bool :value: True .. py:attribute:: depth_write :type: bool :value: True .. py:attribute:: line_width :type: float :value: 1.0 .. py:attribute:: polygon_mode :type: Any .. py:attribute:: polygon_offset :type: tuple[float, float] :value: (0.0, 0.0) .. py:attribute:: point_size :type: float | None :value: None .. py:attribute:: program_point_size :type: bool :value: False .. py:attribute:: cull_face :type: bool :value: False .. py:attribute:: lighting :type: bool :value: False .. py:property:: raster :type: RasterState .. py:property:: depth :type: DepthState .. py:property:: blend_state :type: BlendState .. py:class:: RenderStateApplier(backend: Any) Applies render-state deltas through a gl backend. .. py:attribute:: backend .. py:attribute:: current :type: RenderState | None :value: None .. py:method:: apply(state: RenderState) .. py:class:: GLVertexBuffer(data: numpy.ndarray) .. py:attribute:: data .. py:method:: bind_legacy() .. py:class:: GLAttributeArray gl Attribute Array .. py:attribute:: size :type: int .. py:attribute:: dtype :type: Any .. py:attribute:: stride :type: int .. py:attribute:: pointer :type: Any .. py:method:: enable_legacy(kind) .. py:class:: GLViewport .. py:attribute:: x :type: int .. py:attribute:: y :type: int .. py:attribute:: width :type: int .. py:attribute:: height :type: int .. py:method:: apply() .. py:class:: TestGLMesh(vertices, indices=None) Test gl Mesh .. py:attribute:: vertices .. py:attribute:: indices :value: None .. py:attribute:: attributes :type: list[GLAttributeArray] :value: [] .. py:method:: add_attribute(attr: GLAttributeArray) .. py:method:: draw() .. py:class:: DrawCommand Draw Command .. py:attribute:: mesh :type: Any .. py:attribute:: mode :type: int | None :value: None .. py:attribute:: texture :type: picogl.texture.gltexture_driver.GLTextureDriver | int | None :value: None .. py:attribute:: state :type: RenderState | None :value: None .. py:method:: execute(backend: Any) .. py:class:: GLClipPlaneState gl Clipping Plane State .. py:attribute:: enabled0 :type: bool :value: False .. py:attribute:: enabled1 :type: bool :value: False .. py:method:: apply(state: GLStateManager)