BRender Tutorial Guide:2 Getting Started:Animation Loop

Animation Loop

The code that generates the animation (in this case 360 frames), is listed below.

The back buffer is initialised to the background pixel value. BrPixelmapFill(back_buffer,0) fills the back buffer with 0's, setting the background pixel colour to black.

The Z-Buffer is then initialised to the largest representable z-value. This is 0xFFFF for a 16-bit buffer. 0xFFFFFFFF is passed to accommodate Z-Buffer depths up to 32 bits.

	for(i=0; i < 360; i++) {
BrZbSceneRender renders the scene into back_buffer. BrPixelmapDoubleBuffer then `swaps' screen_buffer and back_buffer (see section on `Double Buffering' in Chapter 1) so the newly rendered image is displayed.

For each iteration of the loop, cube is rotated 2xb0 about the x-axis.

Generated with CERN WebMaker