PDA

View Full Version : changing the color of a luminance/alpha bitmap



fwest
10-30-2004, 10:17 PM
Hello,

I have a problem I cannot solve.
In my programme I put a luminance/alpha bitmap
on the color-buffer. The result is a white image
(a letter/digit). I would like to be able to set
the color, but my first attempts very unsuccessful.

glPixelTransferf(GL_RED_SCALE,float(R))
worked fine, but soooo sloooooow. Is there another
technique to set the color? Low level conversion
of the luminance_alpha bitmap to RGBA is not an
option.

An option would be the use of tectures and GL_MODULATE, but I would like to avoid textures for this.

Thanks,
Frits

Bob
10-31-2004, 12:26 AM
Assuming the imaging subset available, you can use the blending stage. Set the constant blend color to the color you want, and multiply the source fragmens with it. Like this.

glBlendFunc(GL_CONSTANT_COLOR, GL_ZERO);
glBlendColor(1, 0, 0, 1); // Red
glEnable(GL_BLEND);

rgpc
10-31-2004, 01:25 AM
Originally posted by fwest:
An option would be the use of tectures and GL_MODULATE, but I would like to avoid textures for this.
So... You would like to avoid the most efficient way of doing this? You'd rather copy a heap of data across your AGP Bus every frame? Good luck!

fwest
10-31-2004, 04:18 AM
Thanks for the tips. I never thought about the
data-transfer load, only about code complexity.