Monochrome bitmap as Alpha texture

On MS Windows, I want to load a monochrome bitmap resource and use it as a texture for alpha values. I’m having the following problem with this: the bitmap resource, since it is a monochrome bitmap, is packed such that each bit corresponds to a single pixel. Basically, my bitmap is 64x64 pixels, for a total of 4096 pixels. Since there is only 1 bit per pixel, the bitmap consists of only 512 bytes (4096 pixels, 8 pixels in each byte). How do I tell OpenGL that my bitmap is packed in this way?

I tried using a couple of glPixelStore* settings that I thought were correct, but didn’t have success. My tex image 2D call looks like:

glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 64, 64, 0, GL_ALPHA, GL_BITMAP, pBitmapBits);

Any ideas?

It looks like it should work to me; is it creating any texture at all? What does glGetError() report after you create your alpha texture? Also, not sure about this but it could be a byte-ordering issue (might need to set GL_PACK_LSB_FIRST via glPixelStorei()).


What hardware and drivers are you using? If you’ll post the source (or email it to me, I’ll take a look.