blending problem

hello!
i have the following problem:
i am rendering distant clouds into a texture (render-to-texture with pbuffers):

glBlendFunc(GL_ONE, GL_ZERO);
wglBindTexImageARB();
glBegin(GL_QUADS);

glEnd(GL_QUADS);
wglReleaseImageARB();

the pbuffers work fine, but with the blending i get a black QUAD :frowning: and the clouds in the texture have the correct color.
i have also tried other blending parameters, but they didn’t work.
do you know some method to make the quad where i render the cloud in translucent?
thanks :slight_smile:

yeah, you have defined srcGL_ONE + dstGL_ZERO
this means, your source(=fragment color) gets multiplied with one, and your destination(=FRAMEBUFFER) is multiplied with zero.

if your texture has an alphachannel defined use:
glBendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)

for additive blending use: glBendFunc(GL_ONE,GL_ONE)

yes that is the problem
if i use glBlend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
or glBlend(GL_ONE,GL_ONE)
the colors are different as if i draw the clouds direct in the scene and they need to have exactly the same color because i render the distant clouds in a octagonal ring of pbuffers and when they are within the rings radius they are rendered in the scene as 3d volumes. So there should be no difference in color.
but i dont know how to do this :frowning:

so just to be sure, you do:

  1. render clouds into pbuffer
  2. mix this pbuffer on a quad with a 3d-scene.

how do you wirte the clouds into the pbuffer ?
are using additive blending or GL_SRC_ALPHA/GL_ONE_MINUS_ALPHA ?
are you writing into the alpha-channel of the pbuffer ?

anyway, i suggest you to search the web(google) and this forum for “cloud rendering”

some links to check out (the are also talking about blending-issues)
http://www.markmark.net/clouds/
http://www.gdconf.com/archives/2004/wang_niniane.pdf
http://www.gamasutra.com/features/20040114/wang_02.shtml
http://www.vterrain.org/Atmosphere/Clouds/