PDA

View Full Version : glPolygonStipple Pattern !!



Usman
11-05-2010, 12:55 PM
Hy,
anyone tell me how to define glPolygonStipple pattern ?
I have read the redbook but i don't know how to define it ?
Like this fly pattern


GLubyte fly[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0x80,0x01,0xC0,0x06,0xC0,0x03,0x60,
0x04,0x60,0x06,0x20,0x04,0x30,0x0C,0x20,
0x04,0x18,0x18,0x20,0x04,0x0C,0x30,0x20,
0x04,0x06,0x60,0x20,0x44,0x03,0xC0,0x22,
0x44,0x01,0x80,0x22,0x44,0x01,0x80,0x22,
0x44,0x01,0x80,0x22,0x44,0x01,0x80,0x22,
0x44,0x01,0x80,0x22,0x44,0x01,0x80,0x22,
0x66,0x01,0x80,0x66,0x33,0x01,0x80,0xCC,
0x19,0x81,0x81,0x90,0x0C,0xC1,0x83,0x30,
0x07,0xe1,0x87,0xe0,0x03,0x3f,0xfc,0xc0,
0x06,0x64,0x26,0x60,0x0c,0xcc,0x33,0x30,
0x18,0xcc,0x33,0x18,0x10,0xc4,0x23,0x08,
0x10,0x63,0xc6,0x08,0x10,0x30,0x0c,0x08,
0x10,0x18,0x18,0x08,0x10,0x00,0x00,0x08

};



i don't understanding it . . .
Please help me . . .

bcthund
11-05-2010, 03:37 PM
Each bit represents 8 pixels as can be seen in the image below. The values are represented in hexadecimal form but translate into a binary mask. A better way to represent the stipple pattern would be in groups of 4:



0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x03, 0x80, 0x01, 0xC0,
0x06, 0xC0, 0x03, 0x60,
0x04, 0x60, 0x06, 0x20,
0x04, 0x30, 0x0C, 0x20,
0x04, 0x18, 0x18, 0x20,
0x04, 0x0C, 0x30, 0x20,
0x04, 0x06, 0x60, 0x20,
0x44, 0x03, 0xC0, 0x22,
0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22,
0x44, 0x01, 0x80, 0x22,
0x66, 0x01, 0x80, 0x66,
0x33, 0x01, 0x80, 0xCC,
0x19, 0x81, 0x81, 0x98,
0x0C, 0xC1, 0x83, 0x30,
0x07, 0xe1, 0x87, 0xe0,
0x03, 0x3f, 0xfc, 0xc0,
0x03, 0x31, 0x8c, 0xc0,
0x03, 0x33, 0xcc, 0xc0,
0x06, 0x64, 0x26, 0x60,
0x0c, 0xcc, 0x33, 0x30,
0x18, 0xcc, 0x33, 0x18,
0x10, 0xc4, 0x23, 0x08,
0x10, 0x63, 0xC6, 0x08,
0x10, 0x30, 0x0c, 0x08,
0x10, 0x18, 0x18, 0x08,
0x10, 0x00, 0x00, 0x08


Example hex->binary:
0x10 = 00001010
0x63 = 00111111
0x0c = 00010000

http://fly.cc.fer.hr/~unreal/theredbook/chapter02.html

http://fly.cc.fer.hr/~unreal/theredbook/figures/fig2-9.gif