I know hexadecimal numbers but I can`t seem to get how it is used to create a bitmap image or fonts. I studied from the link http://www.glprogramming.com/red/chapter08.html which shows how to create an F. What do the hexadecimal numbers correspond to? For example, what part of the bitmap image does 0xff,0xc0 cover? I thought they gave information about the colour of a pixel.
0xff is 1111 1111 and 0xc0 is 1100 0000.
Put those together and you have 1111 1111 1100 0000, if you repeat the process for each row in your bitmap you get the following:
GLubyte rasters[24] = {
0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xff, 0xc0, 0xff, 0xc0
};
// Keep in mind, the origin of your image is the **bottom-left**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0xff,0xc0 1111111111000000 1111111111
0xff,0xc0 1111111111000000 1111111111
0xc0,0x00 1100000000000000 11
0xc0,0x00 1100000000000000 11
0xc0,0x00 1100000000000000 11
0xff,0x00 1111111100000000 11111111 // The 0s make it hard to read, so I ...
0xff,0x00 1111111100000000 11111111 // removed them on the right-hand side.
0xc0,0x00 1100000000000000 11
0xc0,0x00 1100000000000000 11
0xc0,0x00 1100000000000000 11
0xc0,0x00 1100000000000000 11
0xc0,0x00 1100000000000000 11
This should look pretty familiar ;)
Regarding how this all translates into actual color. OpenGL will replace any part of your bitmap that has a 1 in it with the current raster color (e.g. glColor3f (0.0f, 1.0f, 0.0f)
will produce a green F). 0 bits are simply discarded when you call glBitmap (...)
.