Class SoDepthBuffer

All Implemented Interfaces:
SafeDisposable

public class SoDepthBuffer extends SoNode
Depth buffer parameters node. This class specifies the depth buffer parameters used for rendering, including:
  • Depth buffer test enabled,
  • Depth buffer writing enabled,
  • Depth buffer range, and
  • Depth comparison function.

It can also be used to clear the depth buffer by setting the clearBuffer field to true.

To control whether frame buffer color components are written or not, see SoColorMask.

Limitations:

  • Transparency:
    The "depth peeling" transparency types (SORTED_PIXEL) do not work correctly if this node is used to change depth buffer settings.
  • Test function
    By default SoDepthBuffer sets the OpenGL depth buffer test function to LESS. (Meaning that only fragments with a depth value strictly less than the current depth buffer value will be rendered.) This is NOT the same as the Open Inventor default.

    By default Open Inventor sets the depth buffer test function to LEQUAL and this value is recommended for most applications. Some Open Inventor features, for example SoGradientBackground, will not work correctly with the depth buffer test function set to LESS.

File format/default:

DepthBuffer {

    test true
    write true
    function LESS
    range (0.0,1.0)
    clearBuffer false
}

Action behavior:

SoGLRenderAction

See Also:
  • Field Details

    • test

      public final SoSFBool test
      Enable depth buffer testing (glEnable). Default is true.

      Note that disabling depth testing will prevent the depth buffer from being updated even if depth buffer writing is set to true.

    • write

      public final SoSFBool write
      Enable depth buffer writing (glDepthMask). Default is true.
    • function

      Depth comparison function to use (glDepthFunc). . Default is LESS.
    • range

      public final SoSFVec2f range
      Value range for the depth buffer (glDepthRange). Default is [0.0-1.0]. The range will be clamped to [0.0-1.0] by OpenGL.
    • clearBuffer

      public final SoSFBool clearBuffer
      If true, the depth buffer is cleared when the node is traversed. The extent of the buffer that is actually cleared may be limited using an SoViewportClipping node. Default is false.

      Note: Be careful when using this feature along with a transparency mode other than SoGLRenderAction.NO_SORT because the objects rendering order might be different from their ordering in the scene graph.

      Since:
      Open Inventor 8.6

  • Constructor Details

    • SoDepthBuffer

      public SoDepthBuffer()
      Constructor.