University of California, Berkeley
EECS Dept, CS Division
SLIDE: Scene Language for
Interactive Dynamic Environments
|Prof. Carlo H. Séquin|
The purpose of this assignment is to familiarize yourself with basic OpenGL graphics library programming. You will write a simple graphics editor that allows a user to interactively define an object composed of one or more polygons.
Define the user interface to your program as follows:
1. Click the LEFT mouse button to start defining a polygon. The first vertex is to be located at the position of the cursor when the mouse button was clicked. Every subsequent click of the LEFT mouse button adds a new vertex at the position of the cursor during the click. Each time you add a new vertex, draw a line between the new vertex and the previously defined vertex thus tracing out the polygon as it is being defined.
2. Click the MIDDLE mouse button to close the current polygon. This should automatically draw a line between the last vertex and the very first vertex defined . After the current polygon has been closed, a new polygon can be defined as in Step 1.
3. Click the RIGHT mouse button to exit the program. When you exit, your program should print to a file, a SLIDE description of the polygons you have defined. Each polygon represents a SLIDE face and the collection of all these faces defines a SLIDE object.
Since the polygons in this assignment are 2-dimensional, set the z-coordinate to 0. The x and y-coordinates of your points must be in normalized coordinates (i.e. between 0 and 1) where (0,0) represents the lowerleft-hand corner of the OpenGL window, and (1,1) is the upper right-hand corner. In the object statement, set solid SLF_HOLLOW to avoid back face culling in the viewer, and set shading SLF_WIRE because it is hard to enforce the user creating convex polygons. You will learn more about these values later.
Follow the listed instructions for as1.
The supplied code opens a window and does some default drawing calls. You will have to implement the correct interface and add an appropriate data structure. The data structure should maintain a list of the points for each of the faces (polygons) to make the rendering and the writing out of the SLIDE description work correctly.
1. Using your editor create a scene that contains the outlines of a basic car which contains your initials somewhere within this outline. Remember that since SLIDE only allows the definitions of polygons, components of your car as well as your initials have to be defined as closed polygons. Store the SLIDE description of this scene in a file named car.slf in your as1 directory.
2. Follow the listed instructions for as1.
3. This first assignment is to be done INDIVIDUALLY.
that it is OK to share ideas, but not code!
Submitiing code written by someone else is an act of cheating and will not be tolerated.
SLIDE (Scene Language for Interactive Dynamic Environments) is a language used to create descriptions for dynamic scenes. There is a sample SLIDE file called SIMPLE.slf which describes a square and how to view it.
point pSquareXY ( 0.75 0.75 0 )
point pSquarexY ( 0.25 0.75 0 )
point pSquarexy ( 0.25 0.25 0 )
point pSquareXy ( 0.75 0.25 0 )
face fSquare ( pSquareXY pSquarexY pSquarexy pSquareXy )
object oSquare ( fSquare )
frustum ( -0.5 -0.5 -2 )
( 0.5 0.5 -0.01 )
translate ( 0.5 0.5 1 )
viewport vp win
render vp gCam.iCam.cam oSquare
More information will be given in the
For purposes of assignment 1, the GSI's will be holding temporary
office hours on Friday, Sept. 3.
Pushkar: 10-12 (Soda 5th floor alcove)
Egon: 2-4 (Soda 5th floor alcove).
This page was originally built by Jordan Smith.
Last modified: Friday, 03-Sep-2004 11:09:34 PDT