Meta-Ball Rendering anyone?
Patrick Naughton
naughton at wind.Eng.Sun.COM
Sat Feb 16 07:21:18 AEST 1991
phs424l at vaxc.cc.monash.edu.au writes:
|>
|> drw900 at anusf.anu.edu.au ("Drew R Whitehouse") writes:
|> > |> /*
|> > |> * Hi -
|> > |> * I've been trying to get this Meta-Ball renderer
|> > |> * to work for me with no success. Does anyone out there
|> > |> * know of a public domain Meta-Ball renderer, or does
|> > |> * anyone know how to make this program stop core dumping?
|> >
|> >
|> >
|> > Here's something to try out, it produces a picture - I'm not
|> > sure if this was what they looked like in the article !!
|>
|> Is this for a Silicon Graphics machine? If not, what?
|> Daf.
|> --
|> -------------------------------------------------------------------------------
|> Davyd Norris : "Strange people physicists... In my opinion
|> Physics Dept. : those that aren't already dead are in some
|> Monash University, : way very, very sick." - Douglas Adams,
|> Vic, Australia. : "The Long Dark Tea-time Of The Soul"
|> -------------------------------------------------------------------------------
Yes it is for the SGI as is... but link it with this file and it will run on X11.
(You'll need a 24 bit screen to make it work well...:-)
#include <X11/Xlib.h>
Display *dpy = 0;
int screen;
Colormap cmap;
GC gc;
Window win;
int winw;
int winh;
void
prefsize(w, h)
{
winw = w;
winh = h;
}
void
winopen(name)
char *name;
{
dpy = XOpenDisplay(0);
screen = DefaultScreen(dpy);
cmap = DefaultColormap(dpy, screen);
gc = DefaultGC(dpy, screen);
win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 0, 0, winw, winh, 1, 0);
XSelectInput(dpy, win, ExposureMask);
XStoreName(dpy, win, name);
XMapWindow(dpy, win);
while (1) {
XEvent ev;
XNextEvent(dpy, &ev);
if (ev.type == Expose)
break;
}
}
void
RGBmode()
{
}
void
gconfig()
{
}
void
RGBcolor(r, g, b)
{
XColor color;
color.pixel = 0;
color.red = r << 8;
color.green = g << 8;
color.blue = b << 8;
color.flags = DoRed | DoGreen | DoBlue;
XAllocColor(dpy, cmap, &color);
XSetForeground(dpy, gc, color.pixel);
}
void
clear()
{
XFillRectangle(dpy, win, gc, 0, 0, winw, winh);
}
pnt2i(v, w)
int v;
int w;
{
XDrawPoint(dpy, win, gc, v, w);
}
--
______________________________________________________________________
Patrick J. Naughton email: naughton at sun.com
Sun Labs vmail: (415) 336 - 1080
More information about the Comp.sys.sgi
mailing list