3D plotting library / OpenGL

A

Andrew Dalke

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. SciGraphica seems close, but it has the
Gtk requirement.

I'm yet unsure about if SciPy fits my needs.

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?

Andrew
(e-mail address removed)
 
F

Fernando Perez

Andrew said:
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. SciGraphica seems close, but it has the
Gtk requirement.

I'd seriously recommend you look at VTK again. I've done exactly what you are
describing with Mayavi:

http://amath.colorado.edu/faculty/fperez/faults/

Disregard the timing info, it's old and with some fixes to MayaVi I wrote
(available in current CVS), and a tweaked glyphs user module (which I can send
you if you want it), the speed is extremely fast even for fairly large
datasets.

Mayavi is finkable, though after using fink to pull it in (so you get vtk and
friends) you might want to update to CVS to get some of the recent fixes which
I think are not yet on the fink version.

Cheers,

f
 
R

Robert Kern

Andrew said:
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
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 
M

Mike C. Fletcher

I've got a collection of 3D libraries here:
http://www.vrplumber.com/py3d.py?category=retained
http://www.vrplumber.com/py3d.py?category=science

My own OpenGLContext would likely handle what you've described. It's
scenegraph based, can handle fairly large-ish worlds, allows for writing
mouse-over and mouse-click handlers. It has text support using either
2D or 3D text, and can load VRML97 for defining geometry (spheres,
crosses, and the like). It runs under wxPython, GLUT, PyGame, or (with
some limitations) Tkinter.

On the other hand, scientific visualisation *isn't* it's focus, so one
of the items from the science category might be more appropriate.

Anyway, HTH,
Mike

Andrew said:
I've been looking for a decent 3D plotting library with support
for user selection that works under OpenGl, preferable with wxPython.

....

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.
....
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
 
A

Andrew Dalke

Robert Kern:
Here are the instructions that I posted to the PythonMac mailing list a
while ago:

Thanks. I am able to build and install VTK as per your instructions,
except that I don't see an option for
Toggle VTK_USE_GL2PS on (useful for printing).

Once installed the Examples/Rendering/Python scripts work.
However, I need to get it working under wx and when I try
running Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py
I get the wxRenderWindow to open but there is no cone
displayed in it. The content of the window is blank.

I'm using wx version '2.5.3.1'

Any ideas?

Andrew
(e-mail address removed)
 
R

Robert Kern

Andrew said:
Robert Kern:



Thanks. I am able to build and install VTK as per your instructions,
except that I don't see an option for

Oops. Sorry. Press 't' to toggle the display of advanced options. It's
not important, though.
Once installed the Examples/Rendering/Python scripts work.
However, I need to get it working under wx and when I try
running Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py
I get the wxRenderWindow to open but there is no cone
displayed in it. The content of the window is blank.

I'm using wx version '2.5.3.1'

Any ideas?

I'm afraid I don't. Sorry.

--
Robert Kern
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top