CS559
Fall 2005

News
Calendar
Assignments

Lectures/Notes
Tutorials
Sample Code

Project 1
Project 2
Project 3

Basic Info
Policies

C++ hints


CS559 Sample Code:
3D User Interfaces

This page provides some example code to suggest some ideas on how to do the 3D user interfaces required for Programming Assignment 5 and Project 2.

The idea here is not to show off great user interfaces, but rather to show you that some simple and easy to implement things are workable (and good enough for the assignments and projects).

Also, we'll provide you with some example code to implement some User Interfaces that require some techniques a little beyond what we talk about in class.

From this page are three versions of a program called "CubeIt." Each program creates a set of cubes and allows the user to move them around (fullfilling the requirements of Programming Assignment 5).

CubeIt0
CubeIt0 provides the very most basic interface. A set of sliders is used to control the camera parameters and the cube position. Clicking the left mouse button cycles through the cubes.
CubeIt1
Cubeit1 uses a technique called "ArcBall " to control the viewpoint. The right mouse button is used to move the viewpoint. This is a simplified version of the arcball and can be a little bit hard to control. However, it provides a fast way to look around the world.
CubeIt2
CubeIt2 adds a better interface for moving the cubes. A cube is selected by clicking on it with the left mouse button. Cubes can be dragged with the left mouse button. Normally, dragging happens in the XZ plane (the height of the cube stays the same, but it follows the mouse around). If you hold down the control key, the movement of the cube will be in the XY or YZ plane, so it will move up and down to follow the mouse movement.

The programs were written to show how small and simple they can be. In your own programs, I'd recommend taking a little bit more of an object-oriented approach (for example, creating a class for 3D points rather than passing around 3 floats to every function).

The programs do not make any attempt to draw the cubes nicely. They do not even use lighting. The one fancy display thing they do is "drop" shadows. This was done to show you how to do drop shadows yourself (they will make your programs much nicer). Drop shadows are useful not only because they look nice, but also because they help to convey depth.

The files of Interest: