How to use glTexImage2D load bitmap?

Sorry,I am a programmer who is a Chinese. I cannot speak English very well.I hope you can understand me.

I have a bitmap that is the character “6”.It’s data is {0xFO,0xAA,0xBF,0xC0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}.
I use the function
gluBuild2DMipmaps(GL_TEXTURE_2D,GL_ALPHA,2,16,GL_ALPHA,GL_BITMAP,{0xFO,0xAA,0xBF,0xC0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0})
can load the bitmap.


But it looks so ugly.Dose the gluBuild2DMipmaps scale it?Why?The bitmap’s weight is 2 and height is 16.Both can power of 2. Why the gluBuild2DMipmaps scale it?

I want use glTexImage2D instead of it.Because the bitmap’s weight is 2 and height is 16.Both can power of 2.I think I can use glTexImage2D load it.

But I use the function
glTexImage2D(GL_TEXTURE_2D,0,GL_ALPHA,2,16,0,GL_ALPHA,GL_BITMAP,{0xFO,0xAA,0xBF,0xC0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0})
load it then I draw a white rect not a character ‘6’.

Why?can you help me ?

The bitmap’s weight is 2

Small English point: I think the word you’re looking for is “width”, not “weight”.

Your width cannot be 2. Each byte is 8 bits, and since you’re using GL_BITMAP, that means each bit is an on/off value. You provide 16 bytes, and your height is 16. So your width must be 8.

Also, I don’t know how your GL_BITMAP data looks like the number 6 you show. It would be easier to see what was going on if each byte were a pixel, rather than each bit. But even so, that series of bits doesn’t seem to resemble the image of a 6 that you show.

Lastly, you’ve loaded the data into a GL_ALPHA texture. What texture environment settings (glTexEnv) and blend modes (glBlendFunc) do you use to render with it?

Thanks for your help and the Small English point ( My English is so poor. Because I usually speak Chinese in China.)
My question have already been solved in your help.
Best wishes.
Love.