Sign in to follow this  

alpha/texture question

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

Does black feature in the interior of the texture? If so, you'll need to implement something along the lines of a flood-fill on the loaded and locked texture, to set the contiguous black background's alpha value to zero.

However, if black is acting as a colour-key (so all black pixels appear transparent), then you can get away with using D3DX's colour-key-emulation at load-time, to do the dirty work for you:

Create the texture with a call to D3DXCreateTextureFromFileEx, passing opaque black (0xFF000000) for the 'D3DCOLOR ColorKey' argument. Provided alpha blending is enabled by the time you come to render (a single call to IDirect3DDevice9::SetRenderState(D3DRS_ALPHABLENDENABLE, true) would do the trick) everything should come up roses. I've assumed you're using C++, but under any other version of the API, the syntax is similar.

Admiral

Share this post


Link to post
Share on other sites

This topic is 3859 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this