6. Object-Oriented Ice Cream Flavors and Mixins
There was an ice cream store in Cambridge which was popular with the folks at the MIT AI Lab. Steve’s Ice Cream made their ice cream in the store and would fold in mixins of your choice. Legend has it that is why the Symbolics object system was called Flavors, and abstract superclasses were Mixins. Later Flavors (and Xerox’s LOOPS) would form the basis for CLOS, still the most powerful object system of any programming language.
The Symbolics Lisp Machine was a very advanced (and expensive) workstation. The idea was to put the most powerful programing language and tools on top of the most powerful hardware possible at the time in order to allow skilled programmers to do their best work. Anyone who worked on such systems in those days must at times imagine a better world where that philosophy took hold and prospered, as opposed to losing in the marketplace to inexpensive hardware and low-level languages.
My Lisp Machine — this being the Media Lab — was decked out for graphics with a high-res 1280x1024 (I think) color monitor that could do 24-bit color. There was little in the way of graphics libraries, other than clearing the screen and drawing pixels, lines, and rectangles. Symbolics’s own S-Geometry suite of software packages did not exist yet.
So I created Flavors for 3D points, 4x4 matrices, perspective cameras, polygons, and lights. The result was a 100% script-driven 3D system which did wireframe and shaded display, with the choice of faceted, Gouraud, or Phong shading using a z-buffer for hidden surface removal.
Animation was also done by writing code, though since it took anywhere from seconds to minutes to render each frame, real-time playback was not possible. Well, actually it was, in the form of pan-and-zoom, or flip-book, animation.
Though the Symbolics had no 3D hardware, it did have speedy 2D operations. It was possible to render (for example) 64 images of an animated sequence in an 8x8 grid on the color monitor, then use 2D operations to zoom into one of the images and pan through them, with the result being each (low-res) image being displayed in rapid succession. Like a flip-book.
In my mind’s eye, I can still see the fingers of my polygonal hand model curling and uncurling on the color screen.
Design & Code
The reason I chose CCL (Clozure Common Lisp) is because of its interface to the MacOS Objective-C API. CCL is in fact descended from MCL (Macintosh Common Lisp), developed at Apple’s long-defunct Cambridge Research Lab. Back when Apple cared about programming language research.
The code snippet above is for displaying an OpenGL viewport. It makes calls to both the Cocoa (Objective-C) and OpenGL interfaces. In my rush to get things moving, this code is somewhat haphazard and there are more elegant ways of doing this. But it works and will do for now.
I have been thinking how rule-based systems might be applied to procedural graphics. Started reading on the topic and am curious to see what ideas may emerge as a result.