Quote:Original post by ade-the-heat
it looked like this:
[*a picture*]
Now this is not worse. This is exactly as it is supposed to be - considering your particle has no alpha channel.
Quote:
1. ensure alpha channel for the particle
2. alpha for black parts of particle should be set to 0.0f (totally see through)
3. the skybox should not have an alpha channel (it doesn't)
3. - ok
1. and 2. - sure, but do it with a plan. A perfect solution would be to have an alpha channel just like the color intensity. To do that, I used standard DxTex.exe from DXSDK (I doubt you could download it elswhere, but I suppose any other graphic tool has similar option). There's an option "open onto alpha channel" which lets you use a texture of choice to build the alpha channel.
Then use (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) for normal blending, or (GL_SRC_ALPHA, GL_ONE) for additive blending.
And mission complete ;)
------
Alternatively:
You could use the fact that the particle is white-black, and practicly, you would want the alpha channel to be exactly as... blue. With GL_COMBINE_ARB, you can take alpha for the texture stage from the blue channel, instead of tha alpha channel.
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );{ glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE ); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR ); glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE ); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_COLOR ); // <- alpha from color! glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE );}glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);//glBlendFunc(GL_SRC_ALPHA, GL_ONE);
I'm not sure about this, but I'm quite certain I was using something about that somewhere...
--------------
Alternatively:
Provide the texture in GL_INTENSITY format. Then use simply:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // <- important: ONE for src//glBlendFunc(GL_ONE, GL_ONE);