PDA

View Full Version : GL_LUMINANCE_ALPHA



gimp
12-29-2002, 10:57 PM
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

Bob
12-30-2002, 05:06 AM
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.

gimp
12-30-2002, 11:57 AM
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?

gimp
01-01-2003, 03:11 PM
That was the answer. Thanks bob...