-
Notifications
You must be signed in to change notification settings - Fork 26
Python Reference
Last revision: ver. 4.2-alpha6 - 28 August 2013
omegalib exposes most of its API to Python, so the vast majority of omegalib applications are developed as python scripts. Using python instead of C++ to develop your omegalib application offers several advantages:
- You can port your application to different systems without recompiling. For instance you can develop a script on your laptop, then copy it to CAVE2 and just launch it. Configuration files will do the rest.
- You can modify your application at runtime using the interactive python console
- If you need integration with C++ or need access to advanced omegalib functionality, you can write C++ code as an omegalib module and import it into your python script.
omegalib uses its own python interpreter to run python scripts. The interpreter executable is called orun
, and is built with omegalib when you enable python support.
To run python omegalib programs, you need the orun
application. orun is part of the standard omegalib distribution.
You have two ways to start a script using orun:
- Though the command line using a command in the form:
orun -s <filepath.py>
- After starting orun, typing:
:r <applicationName>
. This is an example of a quick command. For more information on quick commands check the QuickCommands page.
To stop an orun program, press esc, type oexit()
or :q
or press control-C (on linux) at the orun console, or run orun -K
on another terminal.
v5.3 orun also support the -x option to specify a script command that should run right after the script is loaded. This is useful to load customization modules or to specify arguments for the script.
omega
contains all the core functionality of omegalib like scene graph management and event handling. It also offers a few utility functions to manage verious aspects of an omegalib application. omega is always imported by default in omegalib applications, so you do not need to write any import
statement to access its classes and functions.
omegaToolkit is a utility module for omegalib. It exposes some non-core functionalities such as
- a 2D / 3D graphical user interface
- a set of object manipulator techniques based on mouse / touch, 3d wands and kinect tracking
General | ||
ToolkitUtils | ||
ImageBroadcastModule | ||
GUI | ||
Container3dSettings | UiModule | WidgetFactory |
Widget | Container | Button |
Label | Image | Slider |
Menu System | ||
MenuManager | Menu | MenuItem |
Cyclops is a utility library that sits on top of omegalib and OpenSceneGraph. It is designed to speed-up development of simple graphical applications, without having to deal with the low-level details of osg. In a sense, cyclops is the GLUT
library of omegalib. Some of cyclops features are:
- Support for loading scenes defined in a simple xml format
- Easy creation of primitive shapes, like planes, spheres, cubes and so on
- Out-of-the-box support for soft shadows
- An expandable shaders and effects library
Cyclops extension modules, like any other omegalib module, can be installed through cmake based on user's needs. Some cyclops extension modules offer basic functionality, and are installed by default when you install cyclops. Here is a list of them with links to their info pages:
- The sprite module: create efficient 3D sprites (https://github.com/omega-hub/sprite)