Camera

moderngl_window.scene.Camera[source]

Simple camera class containing projection

Methods

Camera.__init__(fov=60.0, aspect_ratio=1.0, near=1.0, far=100.0)[source]

Initialize camera using a specific projection

Keyword Arguments:
 
  • fov (float) – Field of view
  • aspect_ratio (float) – Aspect ratio
  • near (float) – Near plane
  • far (float) – Far plane
Camera.set_position(x, y, z) → None[source]

Set the 3D position of the camera.

Parameters:
  • x (float) – x position
  • y (float) – y position
  • z (float) – z position
Camera.look_at(vec=None, pos=None) → numpy.ndarray[source]

Look at a specific point

Either vec or pos needs to be supplied.

Keyword Arguments:
 
  • vec (pyrr.Vector3) – position
  • pos (tuple/list) – list of tuple [x, y, x] / (x, y, x)
Returns:

Camera matrix

Return type:

numpy.ndarray

Attributes

Camera.matrix

The current view matrix for the camera

Type:numpy.ndarray