class moderngl_window.opengl.projection.Projection3D(aspect_ratio: float = 1.7777777777777777, fov: float = 75.0, near: float = 1.0, far: float = 100.0)[source]

3D Projection

property aspect_ratio: float

The projection’s aspect ratio

Type:

float

property far: float

Current far plane value

Type:

float

property fov: float

Current field of view

Type:

float

property matrix: mat4x4

Current projection matrix

Type:

glm.mat4x4

property near: float

Current near plane value

Type:

float

property projection_constants: tuple[float, float]

(x, y) projection constants for the current projection. This is for example useful when reconstructing a view position of a fragment from a linearized depth value.

tobytes() bytes[source]

Get the byte representation of the projection matrix

Returns:

byte representation of the projection matrix

Return type:

bytes

update(aspect_ratio: float | None = None, fov: float | None = None, near: float | None = None, far: float | None = None) None[source]

Update the projection matrix

Keyword Arguments:
  • aspect_ratio (float) – Aspect ratio

  • fov (float) – Field of view

  • near (float) – Near plane value

  • far (float) – Far plane value