3D plotting library / OpenGL
Robert Kern
rkern at ucsd.edu
Tue Dec 7 22:42:25 EST 2004
Andrew Dalke wrote:
> I've been looking for a decent 3D plotting library with support
> for user selection that works under OpenGl, preferable with wxPython.
>
> For this first project I need to do a 3D scatter plot with
> different colors and glyphs (spheres, crosses, etc.) for the points.
> The axes will be labeled and I would like both mouseover and
> mouse click selection. There will be at most 2,000 points.
>
> I've found several for making graphs, like DISLIN, but most
> don't offer interactivity. I spent many hours trying to get
> VTK working on my Mac under both native and X GUI toolkits,
> without success.
Here are the instructions that I posted to the PythonMac mailing list a
while ago:
Download VTK 4.4 from
http://public.kitware.com/VTK/get-software.php
Download CMake binary installer from
http://www.cmake.org/HTML/Download.html
Attach the CMake disk image and install the package. You will now have,
among other things, programs cmake and ccmake in /usr/local/bin . Make
sure /usr/local/bin is in your PATH.
Unpack the VTK source somewhere.
$ cd ~/src
$ tar zxf ~/downloads/VTK-4.4-LatestRelease.tar.gz
$ cd VTK
Make a subdirectory named "build".
$ mkdir build
$ cd build
Run ccmake with the main VTK directory as its argument.
$ ccmake ..
You should now be in a curses-based text interface. With my Terminal
color settings, I can't see if the options are highlighted as one moves
the cursor, so just look at the bar near the bottom to see which option
is currently highlighted.
Press [c] to start configuring.
Toggle BUILD_SHARED_LIBS on.
Keep VTK_USE_CARBON on. Do not use VTK_USE_COCOA (The Cocoa
implementation is not compatible with Python, yet).
Toggle VTK_USE_HYBRID on (Mayavi uses the vtkHybrid kit).
Toggle VTK_USE_GL2PS on (useful for printing).
Toggle VTK_WRAP_PYTHON on.
Toggle VTK_WRAP_TCL on (Mayavi needs it).
Press [c] to configure. It should have found your framework Python. If
you have installed TclTkAqua, it should also have found the appropriate
frameworks.
If there are no errors, press [g] to generate the makefiles and exit. If
nothing happens press [c] again and try pressing [g] once more. You may
have to go back and forth pressing [c] and [g] until all information is
found.
Execute make and wait until it finishes. This takes a long time. Make
some coffee. In fact, go to Colombia, harvest the beans, roast them,
grind them, and brew your cup of coffee. When you get back, the build
might be finished.
"make install" will install VTK into /usr/local (or whatever directory
you told it to install to).
Change to the Python wrapper directory and install the Python wrappers.
$ cd Wrapping/Python
$ sudo python setup.py install
Add /usr/local/lib/vtk to your DYLD_LIBRARY_PATH. You will almost
certainly want to do this in your ~/.bashrc as well.
$ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib/vtk
You're done!
> SciGraphica seems close, but it has the
> Gtk requirement.
>
> I'm yet unsure about if SciPy fits my needs.
Not for 3D.
> What I was hoping for was a toolkit that worked cross-platform
> and assumed OpenGL is available, leaving me to pass it the
> OpenGL context and a few other essentials, or something that
> made a scene graph that I could render as I wish.
>
> Any pointers, ideas, or suggestions?
OpenGLContext might be your cup of tea. Or Zoe. I don't have much
experience with them, though.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list