Coming Soon!
 |
Version 2 is nearly ready. Click the image for some
screenshots and animations. |
What it does
 |
Produces OpenGL based 3D pictures of cataclysmic variables (polars,
intermediate polars, and non-magnetic systems). |
 |
Uses textures for added realism (starspots, plasma, shadows). |
 |
Captures screenshots or "movies" (multiple screenshots which can be
converted to animated gif's using Gimp). |
What it does not
- Perform SPH simulations of accretions discs and magnetically controlled
flows. I'll leave that to James and Graham...
- Calculates light curves from irradiated secondaries...
What it requires
- An OpenGL compatible library. I use the
Utah-GLX
hardware accelerated XFree86 v3.3.6 3D graphics renderer for
the ATI 3D Rage Pro's chips in my Linux boxes (which is also good enough to
play a little bit of QuakeIII!). Utah-GLX is based on the
Mesa3D (v3.2),
OpenGL-like, graphics library, which can be
used as a standalone software renderer.
- The
GLUT
OpenGL Utility Toolkit which is usually included with Mesa.
- The Independent JPEG Group's free
JPEG library
which is packaged with most modern Linux distributions.
The code was developed on Red Hat Linux 6.1/6.2
(tested with both software and hardware rendering)
and also works on Dec Alpha Digital UNIX V4
(software rendering only, though the displayed colours don't quite match the
Linux version - this may be because I used the more uptodate Mesa
v3.4 on the Alphas).
Once upon a time, it worked on Win98 using the
free Borland compiler
(see http://home.clara.net/paulyg/ogl.htm for details on
how to use OpenGL/GLUT with this compiler).
However, I have since made use of the UNIX getopt routine (to
detect command line options) and unfortunately the equivalent routine is
not included with the free Borland compiler. The original
getopt as released by
AT&T should work in its place,
but I have not had time to test it.
Download & Installation
Get it here: OGL_CV.tar.gz.
(I also have local copies of the Redhat 6.2 Mesa OpenGL rpms for anyone
who needs them.
Libraries:
Mesa-3.2-2.i386.rpm;
Headers:
Mesa-devel-3.2-2.i386.rpm.)
To install, just untar it, edit the Makefile so that the paths to the
GL related libraries/includes are correct, then type "make all".
This should create three executables, "cv" (a polar), "cv_ip" (an
intermediate polar) and "cv_disc" (dwarf nova).
The executables expect to find jpeg texture images in the current
directory.
These are :
-
star_spots.jpg - secondary spots and granulation texture
(made from sunspot images I found on the web).
-
plasma_disc.jpg - disc surface texture (made with the Gimp
plasma plugin, plus a a little bit of whirl-pinch).
-
plasma_curt.jpg - magnetosphere texture (again made with
the Gimp plasma plugin).
-
(The disc shadow texture, which is cast onto the secondary, is made
on the fly.)
I've included textures at different resolutions (128x128pixels or
256x256pixels). Just copy which ever one you want to use to the
appropriate filename. If the textures are not found by
the programs they display simple filled polygons instead - which
still doesn't look too bad.
(NB texture images larger than 256x256 tend to
crash the Utah-GLX GL Rage Pro driver om my PCs
with an out of memory error. Your mileage may vary. Though
why you would want them bigger than this I do not know!)
RedHat 6.2 Binaries
Some people have reported limited success in compiling the code.
So I have created links to precompiled binaries for RedHat 6.2.
Note these binaries still need the GL
and GLUT sharable libraries installed on your PC (see the link to
the Mesa rpms above).
Download the following files into
the directory created when you untarred OGL_CV.tar.gz. (Don't forget to
chmod u+x them to set the execute permissions.)
AM Her like: cv
IP like: cv_ip
DN like: cv_disc
Usage
Command line args:
-
-f -- Go fullscreen. Useful for high resolution screenshots.
-
Other X options remain valid (e.g. -geometry).
Keys:
-
Right Arrow / Left Arrow - rotate CV clockwise / anticlockwise.
-
Up Arrow / Down Arrow - increase/decrease inclination.
-
t or T - toggle between textured polygons and wireframe mode.
-
c or C - disable/enable back face culling.
-
h or H - toggle hidden line removal (useful in wireframe mode only).
-
a or A - toggle animation on or off.
-
d / D - decrease / increase viewing distance to CV.
-
r or R - reset parameters to default values.
-
s or S - capture screenshot. Creates sshotn.jpg.
-
m or M - movie. Step through one cycle making multiple screenshots
(default 40). You can read them into Gimp (v1.1 NOT v1.0)
using the following
script-fu: mgif.scm or
tgif.scm (the latter
allows you to make the background colour transparent).
Just drop the scripts into your ~/.gimp-1.1/scripts directory and
they appear under the Xtns -> Script-fu -> APB menu. (You probably want
to change the default home directory location near the bottom of the
scripts.)
-
w / W - increase / decrease white dwarf phase (cv_ip.c only).
-
x or X - toggle drawing of axes.
Improvements
This was my first major OpenGL based application, and as such has grown
into a slightly unpretty piece of code -- but, hey, it works! I'm sure
there are many improvements that could be made :
- The stream and prominences are just rendered as points.
Should replace with textured quads (e.g. semitransparent plasma).
- The disc splash is an ugly hack which should definitely be improved.
- Replace static display lists with something more dynamic so we
can have prominences which grow and fade, a flowing stream, or even
a "rotating" disc.
- I'm never happy with the colours of the various components
(e.g. the secondary or magnetosphere).
If anyone makes any tweaks/improvements then be sure to pass them back to me.
Tips
-
If you want to make a transparent gif image (or animation), it's best to
change the background colour to one that is not present in the CV,
e.g. blue. Do this by changing the line:
GLfloat bgd_colour[] = {0.0,0.0,0.0,1.0};
to
GLfloat bgd_colour[] = {0.0,0.0,1.0,1.0};
(the order is Red, Green, Blue, opacity).
-
If you are stuck with software rendering and just want a nice screenshot,
toggle to wireframe mode first (as it's quicker), position
the CV then toggle back to texture mode.
Gallery
If people want to use the images/animated gifs created by the
programs in
talks, public understanding of science work, etc, then they are welcome
to, though a little credit would be welcome.
Related software
Rob Hynes also has a number of splendid looking stills from his
(soon to be released) OpenGL based binary star visualisation code.
Check them out
here.
If you found this software useful in anyway whatsoever then
drop me a line.