Skip to main content
`Ctrl`+`K`

# GLGraphicsItem

class pyqtgraph.opengl.GLGraphicsItem.GLGraphicsItem(

  parentItem: GLGraphicsItem = None,

)
  __init__(
    parentItem: GLGraphicsItem = None,
  )
  applyTransform(
    tr,
    local,
  )

    Multiply this object’s transform by tr. If local is True, then tr is multiplied on the right of the current transform:

        newTransform = transform * tr

    If local is False, then tr is instead multiplied on the left:

        newTransform = tr * transform

  childItems()

    Return a list of this item’s children in the scenegraph hierarchy.

  depthValue()

    Return the depth value of this item. See setDepthValue for more information.

  hide()

    Hide this item. This is equivalent to setVisible(False).

  initializeGL()

    Called after an item is added to a GLViewWidget. The widget’s GL context is made current before this method is called. (So this would be an appropriate time to generate lists, upload textures, etc.)

  paint()

    Called by the GLViewWidget to draw this item. It is the responsibility of the item to set up its own modelview matrix, but the caller will take care of pushing/popping.

  parentItem()

    Return a this item’s parent in the scenegraph hierarchy.

  resetTransform()

    Reset this item’s transform to an identity transformation.

  rotate(
    angle,
    x,
    y,
    z,
    local=False,
  )

    Rotate the object around the axis specified by (x,y,z). angle is in degrees.

  scale(
    x,
    y,
    z,
    local=True,
  )

    Scale the object by (dx, dy, dz) in its local coordinate system. If local is False, then scale takes place in the parent’s coordinates.

  setDepthValue(
    value,
  )

    Sets the depth value of this item. Default is 0. This controls the order in which items are drawn–those with a greater depth value will be drawn later. Items with negative depth values are drawn before their parent. (This is analogous to QGraphicsItem.zValue) The depthValue does NOT affect the position of the item or the values it imparts to the GL depth buffer.

  setGLOptions(
    opts,
  )

    Set the OpenGL state options to use immediately before drawing this item. (Note that subclasses must call setupGLState before painting for this to work)

    The simplest way to invoke this method is to pass in the name of a predefined set of options (see the GLOptions variable):

    opaque | Enables depth testing and disables blending
    translucent | Enables depth testing and blending Elements must be drawn sorted back-to-front for translucency to work correctly.
    additive | Disables depth testing, enables blending. Colors are added together, so sorting is not required.

    It is also possible to specify any arbitrary settings as a dictionary. This may consist of {‘functionName’: (args…)} pairs where functionName must be a callable attribute of OpenGL.GL, or {GL_STATE_VAR: bool} pairs which will be interpreted as calls to glEnable or glDisable(GL_STATE_VAR).

    For example:

        {
            GL_ALPHA_TEST: True,
            GL_CULL_FACE: False,
            'glBlendFunc': (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA),
        }

  setParentItem(
    item,
  )

    Set this item’s parent in the scenegraph hierarchy.

  setTransform(
    tr,
  )

    Set the local transform for this object.

    Parameters:

      tr (`pyqtgraph.Transform3D`) – Tranformation from the local coordinate system to the parent’s.

  setVisible(
    vis,
  )

    Set the visibility of this item.

  setupGLState()

    This method is responsible for preparing the GL state options needed to render this item (blending, depth testing, etc). The method is called immediately before painting the item.

  show()

    Make this item visible if it was previously hidden. This is equivalent to setVisible(True).

  transform()

    Return this item’s transform object.

  translate(
    dx,
    dy,
    dz,
    local=False,
  )

    Translate the object by (dx, dy, dz) in its parent’s coordinate system. If local is True, then translation takes place in local coordinates.

  update()

    Indicates that this item needs to be redrawn, and schedules an update with the view it is displayed in.

  updateGLOptions(
    opts,
  )

    Modify the OpenGL state options to use immediately before drawing this item. opts must be a dictionary as specified by setGLOptions. Values may also be None, in which case the key will be ignored.

  viewTransform()

    Return the transform mapping this item’s local coordinate system to the view coordinate system.

  visible()

    Return True if the item is currently set to be visible. Note that this does not guarantee that the item actually appears in the view, as it may be obscured or outside of the current view area.