Jump to content
  • Advertisement
Sign in to follow this  
guillermoro

TransParency?

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

If this wasnt so api specific i would put it in the beginners forumn because i dont think this is a very difficult problem. Im just starting DirectX and ive made a simple program that displays a textured polygon right in the middle of the window. I load the (bmp) texture with D3DXCreateTextureFromFileEx(..) and i specify the ColorKey as D3DCOLOR_RGBA(255,0,0,255); I think i set all of the rendering states correctly but when the polygon is drawn the texture loses its normal red background like i wanted but instead of drawing the background color it draws black. Is there a reason for this. Im not sure if i need to give more information please say so if i do. I can probably just put the whole program in a box its pretty small; Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I believe you have to put in this line:

DEVICE->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);

And I think Managed DirectX is for Visual Basic or C#?
Neither of which you want to use.

Stick with C++ and DirectX ('unmanaged')

Share this post


Link to post
Share on other sites
The color code you use in D3DXCreateTextureFromFileEX is the color you want it to skip over, or rather which color is completely transparent.

Try this:
// enable alpha blending
g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

// disable alpha testing, just in case
g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!