Hello everyone

I'm havnig a tough time making my program do what I want it to do (naturally ). I'm using Direct3D 8 interface.

But first, in short let me describe two different algorithms. I want them result in identical graphics output, but they don't.

1st alg. drawing sprite to backbuffer (this one works fine)

-setting rendertarget to backbuffer
-clearing backbuffer with white color
-drawing half transparent sprite to backbuffer.


2nd alg. drawing sprite to a surface and then to backbuffer (this on doesn't do what I want)


-seting rendertarget to rendertarget texture (ARGB format)
-clearing rendertarget surface with A0R0G0B0
-rendering half transparent sprite to a rendertarget surface
-setting rendertarget to backbuffer
-clearing backbuffer with white color
-rendering newly rendered texture with sprite to backbuffer.


The program doesn't crash. It actually produces some output, but alpha channel is all screwed up. I guessed it has all to do with srcblend and destblend flags. I tired all sorts of combinations, but I can't get the desired result.

In the first algorithm I simply use d3blend_srcalpha for srcblend and d3dblend_invsrcalpha for destblend.

In the second algorithm I use same flags when rendering to a surface, and I use d3dblend_one/d3dblend_invsrcalpha when rendering from a surface to a backbuffer. This combination gives me the closest result, but not the same. I tried many other combinations, non of them work

All textures are in ARGB format.

Can someone help me please?