GLGraphicsItem#
- class pyqtgraph.opengl.GLGraphicsItem.GLGraphicsItem(parentItem: GLGraphicsItem = None)[source]#
- __init__(parentItem: GLGraphicsItem = 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
- 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.
- 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), }
- setTransform(tr)[source]#
Set the local transform for this object.
- Parameters:
tr (
pyqtgraph.Transform3D
) – Tranformation from the local coordinate system to the parent’s.
- 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).
- 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.