9.3. Polygons

Particularly in three dimensions, we very often want to represent our critters by colored polygons, perhaps by just one polygon, perhaps by a few, or perhaps by a whole mesh of them. Computer graphics systems draw polygons in an entirely different way from how they draw bitmaps. A bitmap is based on discrete pixel-by-pixel information, while a polygon is based on coordinates in continuous space. In drawing a polygon, we convert its space coordinates into pixel coordinates, use fill algorithms to color it in, and use line-drawing algorithms to draw its edges.

Windows has a built-in CDC::Polygon(POINT * vertices, int vertexcount) method which makes it easy to rapidly draw polygons on the screen. Our cPolygon class is designed to ...

Get Software Engineering and Computer Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.