stippling masks and the bitmap format

i filled a size 32*32 byte array with 1’s just to test out glPoylgonStipple. the problem is that i have no idea why that created the pattern it did. i’d just like an idea of how the the mask array is unpacked, or how a mask should be created for stippling.

actually, you don’t need 32x32 bytes. what you pass is a 32x32 bit pattern, and 32x32 bit is equal to 4x32 bytes. each row is made up of 32 bits=4 bytes.


GLubyte mask[432];
memset(mask, 1+2+4+8, 4

you get vertical stripes of equal width. note that the orientation of the stripes does not change when you change the view direction.

well that’s good to know. is there any explanation behind the pattern you created? how could i create a horizontal stipple separated only by a single pixel?

almost the same :stuck_out_tongue:

in a byte, the 8 bits have the values

1, 2, 4, 8, 16, 32, 64, 128

you can either set the bits at odd positions:
memset(mask, 1+4+16+64, 4*32);

or the ones at even positions:
memset(mask, 2+8+32+128, 4*32);

the result should look almost the same, only shifted by one bit in horizontal direction.