These defaults are depicted in Figure 31.
Figure 31 BRender defaults
Note the camera position in the centre of the unit cube. To display the cube, either the camera or the cube itself would need to be re-positioned.
The first program on your Tutorial disk is called BRTUTOR1.C
and is listed below. Compile and run it to display a revolving grey cube. BRender programs don't come much simpler than this one. It accepts the defaults depicted above. However, the camera is re-positioned along the positive z-axis so that the cube becomes visible. The cube is then rotated 30xb0 around the y-axis before being set in motion rotating around the x-axis.
Let's examine the program in detail.
Two fundamental BRender data structures are introduced in this program - br_actor
and br_pixelmap
. Models, lights and cameras are described by means of br_actor
data structures. Note the widespread use of pointers. Most BRender functions return pointers to data structures. Be careful to avoid type mismatches when assigning variable values.
A br_actor
data structure is really an index system - it contains pointers to other structures that describe the properties of the relevant actor. br_pixelmap
structures contain information describing buffers, palettes and texture maps. Keep your technical reference manual handy when working through the BRender programs described in this guide. Familiarise yourself with BRender functions, data structures and argument data types as they are introduced. You may also wish to consult relevant BRender header files and to refer to the sample program listings on your Tutorial Programs disk.
Recall the structure of a typical BRender program outlined in Chapter 1. The Initialisation and Termination components of BRTUTOR1.C
are isolated below.