AbstractRenderer is the standard interface for renderers. Each renderer have to implement an initialization function __init__ and a draw method to do the actual drawing using OpenGL or by using other, more basic, renderers.
Usually the renderers have also some custom functions that they use to update themselves. For example a SphereRenderer implements the function update_positions to move the spheres around without having to regenerate all of the other properties.
See also
Graphics and Visualization for a tutorial on how to develop a simple renderer.
Parameters
args, kwargs: Any other argument that they may use.
Generic drawing function to be implemented by the subclasses.
Bases: chemlab.graphics.renderers.base.AbstractRenderer
Instruments OpenGL with a vertex and a fragment shader.
This renderer automatically binds light and camera information. Subclasses should not reimplement the draw method but the draw_vertices method where you can bind and draw the objects.
Parameters
Method to be reimplemented by the subclasses.
Bases: chemlab.graphics.renderers.base.ShaderBaseRenderer
Same as ShaderBaseRenderer with the default shaders.
You can find the shaders in chemlab/graphics/renderers/shaders/ under the names of default_persp.vert and default_persp.frag.
Subclasses should reimplement this method.
Renders a set of spheres.
The method used by this renderer is approximating a sphere by using triangles. While this is reasonably fast, for best performance and animation you should use SphereImpostorRenderer
Parameters
Update the sphere positions.
The interface is identical to SphereRenderer but uses a different drawing method.
The spheres are squares that always face the user. Each point of the sphere, along with the lighting, is calculated in the fragment shader, resulting in a perfect sphere.
SphereImpostorRenderer is an extremely fast rendering method, it is perfect for rendering a lot of spheres ( > 50000) and for animations.
Render atoms by using different rendering methods.
Parameters
Update the atomic positions
Render chemical bonds as cylinders or lines.
Parameters
Render a ball and stick representation of a series of coordinates and bonds.
Parameters
Update the coordinate array r_array
Render a wireframe representation of a series of coordinates and bonds.
Parameters
Render colored points.
Parameters
Update the colors
Update the point positions
Renders an array of triangles.
A lot of renderers are built on this, for example SphereRenderer. The implementation is relatively fast since it’s based on VertexBuffers.
Parameters
Update the triangle colors.
Update the triangle normals.
Update the triangle vertices.
Used to render one wireframed box.
Parameters
Update the box vectors.
Render a set of lines.
Parameters
Start and end position of each line in the form of an array:
s1 = [0.0, 0.0, 0.0]
startends = [[s1, e1], [s2, e2], ..]
Update the colors
Update the line positions
Renders a set of cylinders.
The API is quite similar to LineRenderer
Parameters
Update cylinders start and end positions