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 all 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()