klampt.vis.glinterface module

Defines the GLPluginInterface class, which is a unified base class for plugins to the klampt.vis module.

class klampt.vis.glinterface.GLPluginInterface[source]

Bases: object

Users can add their own hooks into the visualizer by overloading this class’s methods. Each method should return True if the user event was processed. A return value of True stops cascading events to a parent interface.

window

the window to which this plugin is attached. May be None if not attached to an OpenGL window.

Type

QtGLWindow or GLUTWindow

view

the viewport that is currently being used for this plugin.

Type

GLViewport

actions

internally used.

Type

list

add_action(callback, short_name, key, description=None)[source]

Defines a new generic GUI action. The action will be available in a menu in Qt or as keyboard commands in GLUT.

click_ray(x, y)[source]

Returns the world-space ray associated with the camera click at pixel coordinates x,y.

closefunc()[source]
display()[source]
display_screen()[source]
displayfunc()[source]
draw_text(point, text, size=12, color=None)[source]

Draws text of the given size and color at the point (x,y) or (x,y,z). The former method is usually called during display_screen.

eventfunc(type, args='')[source]

Generic hook for other events, e.g., button presses, from the GUI

idle()[source]
idlesleep(seconds)[source]

Asks to sleep the idle function for seconds seconds.

initialize()[source]

Called by backend after the GL context is created but before the event loop starts.

keyboardfunc(c, x, y)[source]
keyboardupfunc(c, x, y)[source]
modifiers()[source]

Retrieves a list of currently pressed keyboard modifiers. Values can be any combination of ‘ctrl’, ‘shift’, ‘alt’.

motionfunc(x, y, dx, dy)[source]
mousefunc(button, state, x, y)[source]
refresh()[source]

Asks for a redraw

reshape(w, h)[source]

Asks to resize the GL window

reshapefunc(w, h)[source]
viewport()[source]

Returns the Viewport instance associated with the current GL view.