schrodinger.graphics3d.quadrilateral module¶
OpenGL quadrilaterals.
The quadrilateral module allows creation and drawing of quadrilaterals. Clients draw using Group instances not through Quadrilateral instances.
Drawing is done in whatever is the current GL rendering context and current GL window. So you must set those prior to drawing. If you are using this with Maestro’s drawing callback mechanism you need not worry about the above details. These are handled for you automatically.
Control over the vertices, color, and opacity of a quadrilateral are provided. See the Quadrilateral class for more info.
If you want to draw a number of quadrilaterals, then create multiple Quadrilateral instances and add them to a Group instance or create a single container instance of type Group and add all primatives to it. Then invoke the Group’s draw() method. In the future we hope to provide a QuadrilateralStrip class which would be optimized to draw a sequence of edge-connected quadrilaterals.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.graphics3d.quadrilateral.
Quadrilateral
(vertices=None, color=None, opacity=1.0, style=1)¶ Bases:
schrodinger.graphics3d.common.Primitive
Class to draw a 3D quadrilateral in OpenGL. Will be drawn in the current OpenGL drawable. This includes the ability to draw into Maestro’s Workspace. It just needs to be the current drawable.
Quadrilaterals should be added to a Group and drawing done via Group.
Create Quadrilaterals and add them to a Group instance like in the following example:
# One big list verts = [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0 ] my_quadrilateral1 = quadrilateral.Quadrilateral(vertices=verts, opacity=0.5, r=1.0, g=0.0, b=0.0) # A list of vertices (each vertex is a list of x, y, z) v1 = [0.0, 0.0, 0.0] v2 = [0.0, 1.0, 0.0] v3 = [1.0, 1.0, 0.0] v4 = [1.0, 0.0, 0.0] my_quadrilateral2 = quadrilateral.Quadrilateral( vertices = [v1, v2, v3, v4], opacity=0.5, r=1.0, g=0.0, b=0.0) quadrilateral_group = quadrilateral.Group() quadrilateral_group.add(my_quadrilateral1) quadrilateral_group.add(my_quadrilateral2) # The draw invocation would likely be in a callback function quadrilateral_group.draw()
-
__init__
(vertices=None, color=None, opacity=1.0, style=1)¶ Constructor requires:
- vertices: List of 12 values: x1, y1, z1 … x4, y4, z4 OR
- list of 4 vertex lists [x, y, z], …, [x, y, z]
- color: One of:
- Color object Color name (string) Tuble of (R, G, B) (each 0.0-1.0)
Optional arguments:
- opacity: 0.0 (invisible) through 1.0 (opaque)
- Defaults to 1.0
style: LINE or FILL. Default is FILL.
-
groupHidden
()¶ Called when the group of this object is hidden. Hide the Maestro object(s).
-
groupShown
()¶ Called when the group of this object is shown. Show the Maestro object, if we are being shown.
-
hide
()¶ Hide the object. It will not be drawn when the group is drawn.
-
isGroupShown
()¶ Returns True if this object’s group is shown. False otherwise.
-
isShown
()¶ Returns True if this object shown. False otherwise.
-
setEntryID
(entry_id)¶ Sets entry ID for Maestro object (necessary to render in tile-by-entry mode.
Parameters: entry_id (str) – Object’s entry ID.
-
setGlowColor
(r, g, b)¶ Sets glow color for the object.
Parameters: - r (float) – Red component of glow color [0.0 .. 1.0]
- g (float) – Green component of glow color [0.0 .. 1.0]
- b (float) – Blue component of glow color [0.0 .. 1.0]
-
setIsGlowing
(is_glowing)¶ Enables or disables glow effect for the object.
Parameters: is_glowing (bool) – Whether the object is glowing.
-
setRightClickOnGObject
(pymodule, pyfunc)¶ Sets the python callback which should be called whenever given graphics object is right clicked.
Parameters: - pymodule (str) – Python module
- pyfunc (str) – Python function
-
show
()¶ Display this object, if it was hidden
-