a question about texture coloring

Hi guys,

I have two textures like below:

the first one(a 7*19 texture with a triangle inside):
0000000000000000000
0000000000001000000
0000000000111000000
0000000011111100000
0000001111111110000
0000111111111111000
0011111111111111100

the second one(a 7*19 texture with a polygon inside):
0000010000000000000
0000111110000000000
0001111111100000000
0001111111111000000
0011111111110000000
0111111111000000000
1111111100000000000

I am gonna map these two textures into framebuffer. And I will
dedicate the blue color to the first one and red color to the second
one. So I have to use the GL_MODULATE so that I can use the glcolor3f
to decide the color of texture before the scan-conversion(Inside
texture buffer, these two textures are just black(0)&white(1)).
What I want is when the two texture overlap to each other(not totally,
but partly), in the area of overlapping, “0” which is black on screen
will not be changed and in the area of “1”, the color should be red
which is mapped later instead of the modulated value of red and blue.
I’ve tried all the parameters, but nothing works.

Any help is appreciated, thanks

kevin

Try clearing the screen to black, then turning on blending with GL_ONE,GL_ONE_MINUS_SRC_ALPHA blend function.

If you need help with that, I suggest the specification (downloadable from the front page of this web site) or the beginner’s forum.

Thanks for your reply.
But it is not working. Maybe you didn’t get what I mean. In the overlap area, if texture1 is black and texture2 is black, the last color should be black. In the place that one of the texture is not black, another one is black, the last value remains as the nonblack value. And if both texture1 and texture2 have nonblack color, the upper one defines the last color.
The combination of "GL_ONE,GL_ONE_MINUS_SRC_ALPHA " is not working. I tried other combinations, no one works.
I think maybe the simple blending function can’t solve this problem. Maybe something in the glextension set can do the work.

Any hint? Thanks,

Jian