View Full Version : stippling masks and the bitmap format
01-19-2006, 07:36 AM
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.
01-19-2006, 09:58 AM
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.
memset(mask, 1+2+4+8, 4*32);
you get vertical stripes of equal width. note that the orientation of the stripes does not change when you change the view direction.
01-19-2006, 11:22 AM
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?
01-19-2006, 12:41 PM
almost the same :p
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.