Multitexturing with 1 texture unit

Started by
13 comments, last by Brother Bob 19 years, 5 months ago
its should work, how are u sure its not working ie the alpha u cant see onscreen
Advertisement
when i do

glBlendFuncSeparate(GL_DST_COLOR, GL_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

it modulates the colors properly, but what i draw isn't translucent like it should be. im using values less than 1.0 for my alpha in my vert color.

when i do

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_COLOR, GL_SRC_COLOR)

it makes whatever i draw translucent properly, but then it doesnt modulate the colors.

like i said in my last post, it seems like its only using the first two params i give it
glBlendFuncSeparate separates the blending function for RGB and alpha so you can combine the two with different functions. The first two parameters defines the blending function for the RGB channels, and the two last parameters the blending function for the alpha channel. Sounds like you want to combine the two blending functions into one function. Or rather, blend the fragments two times.

I think you better describe what exactly you're trying to do, what effect you're trying to achieve, so we can see the whole problem. Describe, in detail, your input data, and what the output should be.
i have a quad which i want to blend over something in the frame buffer. i want to modulate my quad with the frame buffer, so thats what the DST_COLOR, SRC_COLOR is for. but the quad verts have values less than 1.0 for their alpha, so i want to have the quad translucent as well.. which is what the SRC_ALPHA, ONE_MINUS_SRC_ALPHA is for.

is this possible?
So basically, you want Csrc*Cdst*Asrc + Cdst*(1-Asrc) as the result from the blending stage? C is means color, A means alpha and subscript src and dst means source and destination fragments.

If so, then the answer is no, it's not possible. At least not using the fixed function pipeline. It's not possible becuase you need two factors for one of the colors (source or destination), and no blending function setup gives you that. It may be possible using fragment programs, assuming you have access to the frame buffer there. But I don't know, never used it.

Maybe multiple passes or some render to texture solution would help. Maybe someone else could come up with a solution.

This topic is closed to new replies.

Advertisement