PARC Python Animation, Rendering and Compositing
 
 
  Features   Installation   Examples   Reference   Download  

 
Compiling
Installing
Testing
Debugging
 

Compiling

Before compiling, make sure you have installed all of the required libraries, including Python, FreeType, and OpenGL and the GL Utility library.

If you want to compile without FreeType font rendering, change the master Makefile and comment out the line using an octothorpe (#):

USE_FREETYPE = FREETYPE=TRUE

If you want to compile without OpenGL, then you might as well skip the entire TUI module. This means that you will not have any sort of graphical user interface. In the future, we hope to add GUI support for systems without OpenGL.

The system consists of eight separate C libraries, seven of which are compiled directly into Python extension modules. There is one pure python module, scene.py which wraps some of the C extension types with Python classes to allow the user create subtypes. All of the libraries and extensions are compiled into DSO modules. The directory containing the modules must be added to your PYTHONPATH before starting Python before they can be used.

After downloading the compressed tar file, choose a location to place the source code. For example, if you choose /usr/local/src:

% cd /usr/local/src
% tar xvzf 
% cd flarg
% make

This make should build a set of DSO libraries inside each of the library subdirectories in /usr/local/src/flarg/lib. The build will create subdirectories in each library to hold dependency information (dep) and a debug version of the library (dbg). Make sure to check for compilation errors. There shouldn't be any error or warning messages if everything works correctly.

For simplicity, it is easier to install the modules into the default location of /usr/local/lib/flarg before testing, since you can then add that single directory to your PYTHONPATH environment variable. However, you can use the uninstalled modules if you plan to do some coding on the modules. To do so, make sure you set your PYTHON_PATH to point to the dbg subdirectories which contain the modules. Like this (in tcsh):

setenv PYTHONPATH /home/wex/flarg/lib/matrix/opt:\
                  /home/wex/flarg/lib/image/opt:\
                  /home/wex/flarg/lib/geometry/opt:\
                  /home/wex/flarg/lib/shader/opt:\
                  /home/wex/flarg/lib/zb/opt:\
                  /home/wex/flarg/lib/ip/opt:\
                  /home/wex/flarg/lib/tui/opt

If you set your PYTHONPATH in this manner, you can run the test suite before installing. Just run "make test" and it should generate the test images described below.

The targets in the top level Makefile are:

all The default target. Builds optimized versions of the modules
clean Removes all object and .so files
debug Builds debuggable versions of the modules in the dbg subdirectory of each library.
install Installs modules into /usr/local/lib/flarg as explained below
test Runs the test suite

The Makefiles within each library directory are set up with two primary targets, "dbg", the default, which builds a non-optimized version with debugging symbols, "opt" which builds optimized libraries. Unless you set up an installation directory to hold the libraries and header files, you will probably want to add this on the make command line:

make DEBUG_LIBS="list matrix image ip geometry shader zb tui"

This will tell the build system to look in the library directories for all header files and .so files. The make install targets within each library are designed to install the libraries in a location specified as /include and /lib.dbg or lib.opt. So, this works differently than the global install target, which puts only the .so and .py files into /usr/local.

Compiling for SGI IRIX

You need to change the link line argument --whole-archive to -all. You also need to remove the compilation option -Wall.

Installing

To install the system into /usr/local/lib/flarg, just type "make install". If you cannot write to the /usr/local/lib directory, you may need to become root first. You can either make the directory as root and change the permissions, or just run "make install" as root.

Make sure to reset your PYTHON_PATH if you already set it up to point at the dbg subdirectories. If you are only planning on using the toolkit without making any modifications to the code, then you should set your PYTHON_PATH as follows:

setenv PYTHON_PATH /usr/local/lib/flarg

To make sure that everything is working. Just run one of the included tests like this:

% cd examples
% test.py
% displacement.py
% cubegrid.py
 

Testing

Before testing, make sure to set your PYTHONPATH environment variable to point to the location of the necessary modules. If the modules have already been installed, you only need the installtion directory (usually /usr/local/lib/flarg) in the path. If they have not been installed yet, you need to add each library subdirectory to the path.

You can test to make sure that your compilation worked successfully by doing a "make test". This will run a script which sets the PYTHON_PATH to the debug directories and then renders a simple image with a couple of cubes and textures. The resulting image will be placed into the current directory (/usr/local/src/flarg) and can be viewed using the image viewer or any other PPM file viewing tool, such as XV.

% cd examples
% imv.py test_render.ppm

The test images should look like this:

Rending test
Image processing test
Font test

If the font test fails, it is likely that you either did not compile with the FreeType library (check the master Makefile, or add FREETYPE=TRUE on the make command line in lib/ip), or you don't have the default font installed on your machine. Try changing the font in test.py to one of the TrueType or Type1 fonts installed on your machine.

 

Debugging

You can debug the modules using gdb under Linux. Before you start debugging, it is important that your PYTHONPATH is properly setup in your .cshrc file, since gdb will start a new shell and it is difficult to set the path once it has started.

A typical debugging session looks like this:

% gdb /usr/bin/python
(gdb) [wex@spock zb]$ gdb /usr/bin/python
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
(gdb) run
Starting program: /usr/bin/python
[New Thread 1024 (LWP 16198)]
Python 1.5.2 (#1, Mar  3 2001, 01:35:43)
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import test
>>>  
Program received signal SIGINT, Interrupt.
[Switching to Thread 1024 (LWP 16198)]
0x4012ef44 in __libc_read () from /lib/i686/libc.so.6
(gdb) break ZB_add_geometry
Breakpoint 1 at 0x4022a73e: file zb_geometry.c, line 101.
(gdb) c
Continuing.
>>> test.run()
[New Thread 2049 (LWP 16207)]
Delayed SIGSTOP caught for LWP 16207.
[New Thread 1026 (LWP 16208)]
Delayed SIGSTOP caught for LWP 16208.
    Read texture map  noise.ppm 0
 
Breakpoint 1, ZB_add_geometry (zb=0x80fc2c8, geometry=0x813dab0,
    material=0x80e8da8, displacement=0x80f2880, shading_rate=1)
    at zb_geometry.c:101
101         shader_material = SHADER_MATERIAL_get_from_pobj(material);
(gdb)

Notice how we start Python and load the modules before setting any breakpoints. This is because the code is only available after it has been dynamically loaded during the import statement. This is unfortunate because we lose all of our breakpoints each time we rerun the program. Some of the Python IDE environments have tools to solve this problem.