We will cross out that bridge when we come back to it later! Concept 4 : Polygon Stippling ============================== Idea: ===== By default, filled polygons are drawn with a solid pattern. They can also be filled with a 32-bit by 32-bit window-aligned stipple pattern which can be specified using the glPolygonStipple() command. The window to your top-left shows such a stippling pattern to create the image of a fly. The pattern used in the code is highlighted in red in the code. The above pattern is but a hex string of the form 0x???? where 0x indicates hexadecimal notation and each of the '?' is a hex symbol (4 bits). Thus ???? represents a 16 bit string. Eg. if pattern is 0xAB48 this gets translated as 1010101101001000. This gets interpreted as a line with the first three pixels off, then 1 on, then two off, then 1 on and so on. In the above case fly[] has 128 0x?? terms. Each term is 2 hex symbols which are 4 bits each (therefore a total of eight bits per term of fly[]). Thus a total of 128 x 8 = 1024 = 32x32 bits is in fact represented one per pixel of a 32x32 grid. This will be clear in a minute when we build up the fly pattern four terms by four terms. Experiment: =========== Click anywhere on the display screen. Now click the number 1. The center segment goes blank. This is because now we are rendering only the first four terms of fly[] and setting the rest to zero. The problem is that the first four terms of fly are also all zeros. Now press the number 2. Again the center screen is empty. Now we are using the first eight terms of fly[] and setting the rest to zero i.e. black. Again if you take a close look the first eight terms of fly[] are also all zeros. We really start to see things happening only when we include the next four terms of fly[] i.e. the first 12 terms by pressing the number 3 on the keyboard. Now you begin to see the bottom of the flie begin to appear. Continue in this fashion and you will be able to realize how the stipple pattern is used to gradually generate the stippled polygon. The representation scheme is as follows: The first four terms 0x??, 0x??, 0x??, 0x?? represent the bottom row of pixels in the 32x32 grid. The next four terms represent the row above the bottom in the grid and so on.