GL_LUMINANCE_ALPHA

I have a greyscale font, black background, white writing. I want to mask out the black and only display the white.

The problem:

When calling :

gluBuild2DMipmaps(GL_TEXTURE_2D,1,a_Image.GetWidth(),a_Image.GetHeight(), GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (unsigned char*)a_Image.GetData());

This causes an exception. However, when I call the same thing with GL_LUMINANCE replacing GL_LUMINANCE_ALPHA I get the correct texture, with a black background.

Anyone guess I’m doing wrong

My guess is that you don’t have two channels, one for luminance and one for alpha, but only one channel. OpenGL then tries to access parts of the texture that is outside the allocated memory.

That guess is correct. I must have misread my source.

I’be betting then that I could use the greyscale at the alpha channel and a generated plain white image as the luminance channel?

That was the answer. Thanks bob…