PDA

View Full Version : 'Red Book' Query



meez
04-29-2003, 06:23 PM
Just wondering if anyone has read (or is reading) the Third Edition of the 'OpenGL Programming Guide' (AKA 'Red Book').

If so i have a question relating to Example 2-6 (page 61-62). It is regarding Polygon stippling. Anyway, I just wanted to know how the hex numbers in the 'fly' array represent the picture of the fly. I understand about converting the Hex to Binary and a '1' is drawn and nothing is drawn where a '0' occurs. But I just can't physically see the pattern of the fly appearing within these Hex numbers?

Can anyone help me out? I would appreciate it!

Cheers,

nexusone
04-30-2003, 04:41 AM
You need to watch the Matrix a few more times, once you get good enought with coding you can see the results without even running the program....

Once you become one with the computer you will be able to see the fly in the hex code...


http://www.opengl.org/discussion_boards/ubb/smile.gif


Originally posted by meez:
Just wondering if anyone has read (or is reading) the Third Edition of the 'OpenGL Programming Guide' (AKA 'Red Book').

If so i have a question relating to Example 2-6 (page 61-62). It is regarding Polygon stippling. Anyway, I just wanted to know how the hex numbers in the 'fly' array represent the picture of the fly. I understand about converting the Hex to Binary and a '1' is drawn and nothing is drawn where a '0' occurs. But I just can't physically see the pattern of the fly appearing within these Hex numbers?

Can anyone help me out? I would appreciate it!

Cheers,

05-01-2003, 09:24 AM
I have an older copy of the book, and the "fly" is on p. 60 for me.
If you would write out the bits of each byte sequentially you will see that the "1s" make the white lines and the "0s" make the black.
The first line is all zeros, so that will be all black. The second line, first number, is 0x03, which is 0000000000000011 in binary bits. The second number is 0x80, which is 0000100000000000, the third is 0x01 which is 0000000000000001. The fourth is 0xC0, which is 0000110000000000. The previous page ( page 59 for my book ) has a picture of this with the binary values labeled, though the colors are reversed from the picture on p. 60 with 1s being black and 0s being white ( don't know why they chose this contradiction ). Good luck,
stereo_barryo

05-01-2003, 09:29 AM
Sorry, my previous post was done using a byte for each hex digit when it is really a nybble. Thus 0x01 is 00000001, 0xc0 is 11000000, etc.

meez
05-01-2003, 02:18 PM
Hey thanks for that. Makes a lot more sense now. I'll just have to convert a few of the Hex Values to binary to see if i can see a pattern occuring.

Cheers,


Originally posted by stereo_barryo:
Sorry, my previous post was done using a byte for each hex digit when it is really a nybble. Thus 0x01 is 00000001, 0xc0 is 11000000, etc.

meez
05-01-2003, 03:00 PM
Thanks,

Yeah, i'm just going to have to convert some numbers to binary and look at it that way! Just until i get more used of hex numbers anyway.

Thanks for your help!


Originally posted by nexusone:
You need to watch the Matrix a few more times, once you get good enought with coding you can see the results without even running the program....

Once you become one with the computer you will be able to see the fly in the hex code...


http://www.opengl.org/discussion_boards/ubb/smile.gif