Jump to content
  • Advertisement
Sign in to follow this  
wangxu

how can i use directx render a alpha picture?

This topic is 2552 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

when i load a png picture with alpha channel,i use the code below:
Device->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
Device->SetRenderState(D3DRS_ALPHAREF, 0x20);[attachment=6475:dx.png]
Device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
to render the picture on a vertexbuffer quad.its effect like this:(the dx.png)
[attachment=6475:dx.png]
and i rerender it in xna with default settings
[attachment=6476:xna.png]
why is there has a so huge difference??how can i render the effect like xna with my dx(direct3d)??
thx a lot!!!

Share this post


Link to post
Share on other sites
Advertisement
You used the alpha test which makes a binary decision whether a pixel is discarded or not, so the transparency is either zero or one. If you want to have values in between zero and one you have to use alpha blending instead. In the documentation you find some more information on its parameters Blend and BlendOp, as well. (In case you like to experiment with other blending operations than conventional transparency.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!