opengl.projection.Projection3D

moderngl_window.opengl.projection.Projection3D[source]

3D Projection

Methods

Projection3D.__init__(aspect_ratio=1.7777777777777777, fov=75.0, near=1.0, far=100.0)[source]

Create a 3D projection

Keyword Arguments:
 
  • aspect_ratio (float) – Sspect ratio
  • fov (float) – Field of view
  • near (float) – Near plane value
  • far (float) – Far plane value
Projection3D.update(aspect_ratio: float = None, fov: float = None, near: float = None, far: float = None) → None[source]

Update the projection matrix

Keyword Arguments:
 
  • aspect_ratio (float) – Sspect ratio
  • fov (float) – Field of view
  • near (float) – Near plane value
  • far (float) – Far plane value
Projection3D.tobytes() → bytes[source]

Get the byte representation of the projection matrix

Returns:byte representation of the projection matrix
Return type:bytes

Attributes

Projection3D.aspect_ratio

The projection’s aspect ratio

Type:float
Projection3D.fov

Current field of view

Type:float
Projection3D.near

Current near plane value

Type:float
Projection3D.far

Current far plane value

Type:float
Projection3D.matrix

Current numpy projection matrix

Type:np.ndarray
Projection3D.projection_constants

(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.