klampt.vis.glcommon module¶
Defines GLWidgetPlugin, GLMultiViewportProgram, and CachedGLObject, which are used by the core visualization module. They may be useful for writing your own GLPluginInterface classes, too.
-
class
klampt.vis.glcommon.
CachedGLObject
[source]¶ Bases:
object
An object whose drawing is accelerated by means of a display list. The draw function may draw the object in the local frame, and the object may be transformed without having to recompile the display list.
-
draw
(renderFunction, transform=None, args=None, parameters=None)[source]¶ Given the function that actually makes OpenGL calls, this will draw the object.
If parameters is given, the object’s local appearance is assumed to be defined deterministically from these parameters. The display list will be redrawn if the parameters change.
-
-
class
klampt.vis.glcommon.
GLMultiViewportProgram
[source]¶ Bases:
klampt.vis.glprogram.GLProgram
A GLProgram that splits the window into several sub-views. Each view is a GLProgram or GLPluginInterface.
-
displayfunc
()[source]¶ All OpenGL calls go here. May be overridden, although you may wish to override display() and display_screen() instead.
-
draw_text
(point, text, size=12, color=None)[source]¶ Draws text of the given size and color at the given point. Usually called during display_screen.
-
idlefunc
()[source]¶ Called on idle. Default value stops all additional idle calls. Must be overridden if you want to do something in the idle loop.
-
initialize
()[source]¶ Called after the GL context is initialized, but before main loop. May be overridden. Users should not call this directly!
-
keyboardfunc
(c, x, y)[source]¶ Called on keypress down. May be overridden. c is either the ASCII/unicode character of the key pressed or a string describing the character (up,down,left,right, home,end,delete,enter,f1,…,f12)
-
-
class
klampt.vis.glcommon.
GLWidgetPlugin
[source]¶ Bases:
klampt.vis.glinterface.GLPluginInterface
A GL plugin that sends user events to one or more Klamp’t widgets. To use, add this to a GLPluginProgram and call addWidget to add widgets