The book says “this is the dreaded math chapter.” I’m an aerospace engineer specializing in dynamics and control theory, so I don’t mind matrix math, so the book’s discussion isn’t at the level of detail I’d like to see. Anybody have any suggestions on where to find good discussions of this material?
The chapter’s first sample program draws an “atom” with three yellow electrons orbiting a red nucleus. It’s therefore another animation program using a depth buffer. At first, the depth testing didn’t work: the electrons weren’t blocked when going behind the nucleus. After spending a while working on later sample programs, I realized that I had forgotten to add the size of the depth buffer to the pixel format attributes. Adding NSOpenGLPFADepthSize, 8, to the list of NSOpenGLPixelFormatAttribute attrs fixed the problem.
I also worked up the solar system demo (actually just the Sun, Earth and Moon). I decided to change the colors and relative sizes of the bodies and rescaled the Earth/Moon orbital rates to make things a bit more realistic, and got a great demo: it’s almost eerie to see the Earth and Moon changing phase as they orbit around the Sun. And that’s even without any surface texturing, just solid-colored spheres!
I picked the dull-red color for the moon based on an animation taken from a mission that I can’t recall at the moment, and changed the Earth’s color from a straight blue to a blue-green. Later in the book I will learn how to wrap an image around a sphere, so when I get to that chapter, I will add them to this application. The Sun could use sunspots to make it look better.