Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


how to use alpha test on rendertarget?

This topic is 5137 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The dxsdk is a bit confusing, so I come to ask here. I want to blend a texture onto the rendertarget surface where I already have put something on. Whether an alpha blend or alpha test is OK. How should I setrenderstate and settexturestagestate?

Share this post

Link to post
Share on other sites
If you just want to blend a texture with what''s on the render target, you can do the following:

d3dDevice->SetRenderState (D3DRS_ALPHABLENDENABLE, true);

Remember you need a pixel format that employs multiple alpha bits, such as A8R8G8B8, in order to use alpha blending.

For single texture rendering, just do this:

d3dDevice->SetTexture (0, pTexture);

where pTexture is a pointer to your texture.

Best wishes.

Share this post

Link to post
Share on other sites
Do you mean

SetTexture (0, pTextureBackground);
SetTexture (0, pTextureOverlay);

But it grow up to be totally white soon.
It''s ok when I set the two textures onto two texture stages,
and set the stage operations.

Share this post

Link to post
Share on other sites
as I understand you, you just want to know the settings for blending two normal textures stages.
I''m afraid this is VB-Code, but you surely will be able to convert it...

d3dDev.TextureState(0).ColorOperation = TextureOperation.Modulate
d3dDev.TextureState(0).ColorArgument1 = TextureArgument.TextureColor
d3dDev.TextureState(0).ColorArgument2 = TextureArgument.Current

d3dDev.TextureState(1).ColorOperation = TextureOperation.Modulate
d3dDev.TextureState(1).ColorArgument1 = TextureArgument.TextureColor
d3dDev.TextureState(1).ColorArgument2 = TextureArgument.Current

you can also use

d3dDev.TextureState(1).ColorOperation = TextureOperation.Modulate2X


d3dDev.TextureState(1).ColorOperation = TextureOperation.Modulate4X

if you want the second texture to appear stronger.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!