[random colours PIC] M3G Chapter 6.   Dynamically Textured Billboards


[ This chapter does not appear in the book. ]

M3G chapter 5 uses the AnimBillboard class to display a series of GIFs as textures on a square mesh. AnimBillboard is a variant of the Billboard class from M3G chapter 4, which displays a single image.

Both AnimBillboard and Billboard stay z-axis aligned with the current camera position, and their images can have transparent elements.

This chapter describes yet another type of Billboard, DynaBoard. In common with AnimBillboard, it creates a square mesh of length size, resting on the XZ plane at the origin, that stays aligned with the camera. However, its rendered images are generated dynamically at execution time.

[counter PIC]

The DynaM3G application illustrates two uses of DynaBoard, both shown in screenshots on the right of this page.

The version of DynaM3G shown at the top of this page displays a constantly changing random patchwork of red and green squares. The second version (which requires a few lines of code be changed in DynaBoard), renders a counter, which progresses from 0 to 99, then repeats.

DynaBoard functionality is useful in situations where the nature of the rendered image can't be determined until the application is running. For example, images containing user names can't generally be created ahead of time. DynaBoard also allows an application to offer more variety, since the choice of images isn't limited to a predetermined selection. For instance, an explosion can look different each time, and error messages can be tailored to the particular scenario that caused them.

There is a downside to this flexibility: processing time must be expended on creating the images.




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page