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.GLWidgetPlugin[source]
Bases:
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
- widgetchangefunc(event)[source]
Called whenever a widget is clicked or dragged. event can be ‘mousedown’, ‘mousedrag’, ‘mouseup’. Subclasses can use this to respond to widget click events
- class klampt.vis.glcommon.GLMultiViewportProgram[source]
Bases:
GLProgram
A GLProgram that splits the window into several sub-views. Each view is a GLProgram or GLPluginInterface.
- initialize()[source]
Called after the GL context is initialized, but before main loop. May be overridden. Users should not call this directly!
- displayfunc()[source]
All OpenGL calls go here. May be overridden, although you may wish to override display() and display_screen() instead.
- 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)
- keyboardupfunc(c, x, y)[source]
Called on keyboard up (if your system allows it). May be overridden.
- mousewheelfunc(dhorizontal, dvertical, x, y)[source]
Called when the wheel is scrolled. Most wheels have dhorizontal=0. x and y are the position of the mouse when the wheel is scrolled. May be overridden.
- 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.
- 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.
- mark_changed()[source]
Marked by an outside source to indicate the object has changed and should be redrawn.
- 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.