wxPython and S2PLOT

13 views
Skip to first unread message

Matthew Turk

unread,
Jun 24, 2008, 11:36:41 PM6/24/08
to S2PLOT
Hi there. I'm developing an AMR analysis toolkit (in Python) which
supports S2PLOT as a means of rendering, if it finds the s2plot python
module. (Specifically, it supports phase diagrams, halo plotting, and
some fixed-res datacubes.) First off, let me say, S2PLOT is an
impressive piece of software. It's been easy to use and it puts out
great images that are clearly designed to present data with an eye
toward intelligent visualization.

One of the primary entry points to the analysis toolkit is via a
wxPython GUI. I've had no success spawning S2PLOT windows from within
the wxPython framework -- I assumed this might be because of the
different threading models, but additionally the duplicate calls to
glutInit. Ideally, one would be able to initialize a wxGLCanvas
(http://wiki.wxwidgets.org/WxGLCanvas) inside a managed wxPython
window, but not initialize the GLUT environment. (Obviously this
could compromise the different display methods -- so maybe it isn't a
workable solution.)

Has there been any effort to embed the interactor window inside other
GUIs? Is this a hopeless proposition? Perhaps the best option would
be to spawn a sub-thread that would handle the rendering but not
interact with the wxPython event loop; could I then use something like
the S2PLOT_BGIMG environment variables to mock-up the behavior I am
referring to?

Thanks again for all your hard work; I think this package is going to
improve the quality of 3D plots for a variety of scientific endeavors.

-Matt Turk

David Barnes

unread,
Jun 25, 2008, 7:31:20 PM6/25/08
to S2PLOT
Hi Matthew,

thanks for the comments and positive feedback on S2PLOT. Always nice
to hear what people are doing, or trying to do, with the library.

> Has there been any effort to embed the interactor window inside other
> GUIs? Is this a hopeless proposition? Perhaps the best option would
> be to spawn a sub-thread that would handle the rendering but not
> interact with the wxPython event loop; could I then use something like
> the S2PLOT_BGIMG environment variables to mock-up the behavior I am
> referring to?

Yes, we have recently been working on a version of S2PLOT which does
not require Glut (or GLU, incidentally) libraries. Our purpose is to
get S2PLOT working within the Mac OS X Cocoa environment, but equally
it might enable the sort of things you want to do.

It's not as easy as spawning a sub-thread though. Only Mac OS X >=
10.5 (Leopard) allows OpenGL rendering to occur anywhere other than
the main thread of a program; I'm not sure what the case is for Linux/
NVidia OpenGL at this point in time. Accordingly, these are two
different things:

1. extracting the Glut components of S2PLOT and allowing other
libraries to control the event loop for S2PLOT.

2. off-loading S2PLOT rendering to a non-main thread.

We are presently working on the first of these. Later in the year we
hope to create an open-source release of S2PLOT which will include
this change.

Hope this helps,

- David Barnes.
Reply all
Reply to author
Forward
0 new messages