Class (GI Struct)

Cogl-18CoglDepthState

Functions for describing the depth testing state of your GPU.

Index

Constructors

Properties

$gtype: GType<DepthState>

Methods

  • Initializes the members of state to their default values.

    You should never pass an un initialized Cogl.DepthState structure to cogl_pipeline_set_depth_state().

    Returns void

  • Sets the range to map depth values in normalized device coordinates to before writing out to a depth buffer.

    After your geometry has be transformed, clipped and had perspective division applied placing it in normalized device coordinates all depth values between the near and far z clipping planes are in the range -1 to 1. Before writing any depth value to the depth buffer though the value is mapped into the range [0, 1].

    With this function you can change the range which depth values are mapped too although the range must still lye within the range [0, 1].

    By default normalized device coordinate depth values are mapped to the full range of depth buffer values, [0, 1].

    NB: this won't directly affect the state of the GPU. You have to then set the state on a Cogl.Pipeline using cogl_pipeline_set_depth_state().

    Parameters

    • near_val: number

      The near component of the desired depth range which will be clamped to the range [0, 1]

    • far_val: number

      The far component of the desired depth range which will be clamped to the range [0, 1]

    Returns void

  • Enables or disables depth testing according to the value of enable.

    If depth testing is enable then the Cogl.DepthTestFunction set using cogl_depth_state_set_test_function() us used to evaluate the depth value of incoming fragments against the corresponding value stored in the current depth buffer, and if the test passes then the fragments depth value is used to update the depth buffer. (unless you have disabled depth writing via cogl_depth_state_set_write_enabled())

    By default depth testing is disabled.

    NB: this won't directly affect the state of the GPU. You have to then set the state on a Cogl.Pipeline using cogl_pipeline_set_depth_state()

    Parameters

    • enable: boolean

      The enable state you want

    Returns void

  • Enables or disables depth buffer writing according to the value of enable. Normally when depth testing is enabled and the comparison between a fragment's depth value and the corresponding depth buffer value passes then the fragment's depth is written to the depth buffer unless writing is disabled here.

    By default depth writing is enabled

    NB: this won't directly affect the state of the GPU. You have to then set the state on a Cogl.Pipeline using cogl_pipeline_set_depth_state()

    Parameters

    • enable: boolean

      The enable state you want

    Returns void