GLGraphicsItem

class pyqtgraph.opengl.GLGraphicsItem.GLGraphicsItem(parentItem=None)[source]
__init__(parentItem=None)[source]
applyTransform(tr, local)[source]

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()[source]

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

depthValue()[source]

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

hide()[source]

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

initializeGL()[source]

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()[source]

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()[source]

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

resetTransform()[source]

Reset this item’s transform to an identity transformation.

rotate(angle, x, y, z, local=False)[source]

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

scale(x, y, z, local=True)[source]

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)[source]

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)[source]

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)[source]

Set this item’s parent in the scenegraph hierarchy.

setTransform(tr)[source]

Set the local transform for this object. Must be a Transform3D instance. This transform determines how the local coordinate system of the item is mapped to the coordinate system of its parent.

setVisible(vis)[source]

Set the visibility of this item.

setupGLState()[source]

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()[source]

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

transform()[source]

Return this item’s transform object.

translate(dx, dy, dz, local=False)[source]

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()[source]

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

updateGLOptions(opts)[source]

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()[source]

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

visible()[source]

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.