# moderngl_window.geometry

moderngl_window.geometry.bbox(size=(1.0, 1.0, 1.0), name=None, attr_names=<class 'moderngl_window.geometry.attributes.AttributeNames'>)

  Generates a bounding box with (0.0, 0.0, 0.0) as the center. This is simply a box with `LINE_STRIP` as draw mode.

  Keyword Arguments:

    - size (tuple) – x, y, z size of the box

    - name (str) – Optional name for the VAO

    - attr_names (AttributeNames) – Attribute names

  Returns:

    A `moderngl_window.opengl.vao.VAO` instance

moderngl_window.geometry.quad_fs(attr_names=<class 'moderngl_window.geometry.attributes.AttributeNames'>, normals=True, uvs=True, name=None) → VAO

  Creates a screen aligned quad using two triangles with normals and texture coordinates.

  Keyword Arguments:

    - attr_names (AttributeNames) – Attrib name config

    - normals (bool) – Include normals in VAO

    - uvs (bool) – Include texture coordinates in VAO

    - name (str) – Optional name for the VAO

  Returns:

    A `VAO` instance.

moderngl_window.geometry.quad_2d(size=(1.0, 1.0), pos=(0.0, 0.0), normals=True, uvs=True, attr_names=<class 'moderngl_window.geometry.attributes.AttributeNames'>, name=None) → VAO

  Creates a 2D quad VAO using 2 triangles with normals and texture coordinates.

  Keyword Arguments:

    - size (tuple) – width and height

    - pos (float) – Center position x and y

    - normals (bool) – Include normals in VAO

    - uvs (bool) – Include texture coordinates in VAO

    - attr_names (AttributeNames) – Attrib name config

    - name (str) – Optional name for the VAO

  Returns:

    A `VAO` instance.

moderngl_window.geometry.cube(size=(1.0, 1.0, 1.0), center=(0.0, 0.0, 0.0), normals=True, uvs=True, name=None, attr_names=<class 'moderngl_window.geometry.attributes.AttributeNames'>) → VAO

  Creates a cube VAO with normals and texture coordinates

  Keyword Arguments:

    - width (float) – Width of the cube

    - height (float) – Height of the cube

    - depth (float) – Depth of the cube

    - center – center of the cube as a 3-component tuple

    - normals – (bool) Include normals

    - uvs – (bool) include uv coordinates

    - name (str) – Optional name for the VAO

    - attr_names (AttributeNames) – Attribute names

  Returns:

    A `moderngl_window.opengl.vao.VAO` instance

moderngl_window.geometry.sphere(radius=0.5, sectors=32, rings=16, normals=True, uvs=True, name: str = None, attr_names=<class 'moderngl_window.geometry.attributes.AttributeNames'>) → VAO

  Creates a sphere.

  Keyword Arguments:

    - radius (float) – Radius or the sphere

    - rings (int) – number or horizontal rings

    - sectors (int) – number of vertical segments

    - normals (bool) – Include normals in the VAO

    - uvs (bool) – Include texture coordinates in the VAO

    - name (str) – An optional name for the VAO

    - attr_names (AttributeNames) – Attribute names

  Returns:

    A `VAO` instance