Reputation: 56262
Is it possible to perform blending with one alpha channel per component (one for red, one for green and one for blue) with OpenGL? If not, what are some possible workarounds?
Upvotes: 5
Views: 904
Reputation: 30014
You could do this with a pixel shader, but you'd need to find a way to store/access per component alpha values. You could store them in a texture and treat the normal color components as the alpha values for the corresponding color.
What effect/output are you trying to achieve?
Upvotes: 1
Reputation: 18015
What you're describing is not possible with OpenGL.
That said, considering that you're new to OpenGL, maybe what you're describing is not exactly what you're after ?
Blending is the step that happens once you decided what color your current fragment (usually coming from a triangle) is supposed to have. That color needs to be merged with the previous color in the frame-buffer. Are you sure that's what you're after ?
Upvotes: 0
Reputation: 52519
This isn't something that's directly supported. It's fairly easy to achieve on your own though:
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR)
glBlendFunc(GL_ONE, GL_ONE)
Upvotes: 3