This program is a simple game. So simple that in fact the user can't lose. The user is given a window in which there are three colored boxes to the left and three rectangle next to and lower than the three colored boxed. The object of the game is to use the mouse to drag one of the colored boxes into one of the rectangles. If the colored box is dropped exactly inside a rectangle then the score for that rectangle is incremented and a pleasing tone is played. If the colored box doesn't go in the rectangle a displeasing noise is made and the score is not incremented.
As a programming exercise this example shows some basic mouse programming. It also shows how to stash sound files in the application bundle and get them out again for use in the program. Notice that we are using no controls or widgets even though all the visual features of the UI must be positioned and size just like controls. The entire interface is just mouse and draw.
This application is a 2D plotting program. (A program that is similar to this, but written in C++, is on the C++ page.) It reads data from a text file describing a 2D curve and draws it out. The center of view can be moved left, right, up and down. The view can also zoom in or out. The user may set the plot color, background color, axis and window colors. Axes drawing is also a user selectable option. User option are stored as persistent defaults. At any time the user can save the current display to a PDF file.
This program gives the programmer a general purpose OpenGL viewer. Most of the rendering code in this example is in the DrawingFunctions.h file. The rest of the code just gets the drawing up on the screen. Controls are provided to change the view and light positions. This is a little different than the usual GLUT demo window in that it is structured more like a normal application where OpenGL is used for something functional rather than being just another cheesey demo.
This is a program that simulates a wave disturbance propagating on a two dimensional membrane. The program uses a timer to step the simulation. At each step a two dimensional wave equation is solved by using a finite differencing sheme that is space centered and time forward. The initial conditions have been exagerated for better visibility in the OpenGL output. See the program notes for controlling the view point and lighting of the OpenGL rendering. A similar program done in VC++6.0 is on the C++ page.)
The stepper control offered by Cocoa and configuarable in InterfaceBuilder is somewhat lacking. It has maximum and minumum values and the value it can take is restricted to this range. The value can be clamped or wrapped within this range according to programmer specification. This behavior is just an enhanced slider control behavior. What I want is a spin button that has no minimum or maximum value. In addition to this I want to be able to control each decimal place in the current value. This program illustrates the method I devised to make the Cocoa stepper control into an unbound spinner control.
This is another OpenGL program that expands on the Avian class as used in the OpenGLStage (see above) application. The Rocket class is a subclass of Avian that allows a rocket object to be positioned and oriented in 3D space. A timer is used to make it fly in a circle.
FlyingRocket.sit 72 KBThis is similar to the Flying Rocket program except that the user can control the position and orientation of the rocket by using the controls on the UI. The controls are the same as in the OpenGLStage (see above) application.
RocketTrainer.sit 108 KB© 2003 J. L. De Spears