CZ2104, Lab 4, due Wed, 4 October 2000


This set of exercises is for 3D model building.  Part 1 and 2 are compulsory (100 marks).  No Part 3.


[Best viewed by IE5 or Word]





Comments, hints, and what to hand in:


Part 1


In our textbook, the picture of a temple appears in numerous places.  Using the page distributed in class (a magnified version of Fig. 5.5. of 1st edition), define the temple as wire-frame.  The effect of wire-frame is achieved by changing the GL_POLYGON as GL_LINE_LOOP.  Alternatively, you can still draw them as polygons, but change the global setting as how the polygons are rendered.  


The exact geometric dimensions of the temple should be measure from the figure in units of mm (millimeter).


You should use as far as possible the OpenGL transformation functions to draw the temple, e.g., the bottom three plates should be draw with three scaled unit cubes, define one pillar and translate it to various places.


You decide how to draw the pillars.


1.: hand in the code. Your code should be carefully commented.  Also keep your soft copy in your directory for TA to inspect.  Same for Part 2.


You should not consider the temple as points connected by lines, you should consider it as surfaces of polygons.  This point of view is important later when we shine light to the temple.



Part 2


Development an interactive viewing of the temple, with the usual orthographic projection, as follows:


(a)   Each press of mouse button rotates the temple for 5 degree.  The left button will rotate along x axis, middle button along y axis, and right button along z axis.


(b)   Press key ‘q’ or ‘Q’ or ‘Esc’ (escape key) will terminate the program and exit the window.








2.: The rotating cube example in the textbook may help.   Unlike the rotating cube, the temple should not rotate all the time, but only when button is pressed.