Archived

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

jeffakew

Direct X8 transparency

Recommended Posts

Hello, I have a problem with getting transparency to work with textures if I am manually setting the data on the texture (ie locking and doing what ever to it during initialisation) normally I just set the color key when I load the texture with: D3DXCreateTextureFromFileExA(Device,"Sprites/Player1.dds" ,NULL,NULL,1,0,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,D3DX_DEFAULT ,D3DX_DEFAULT,0xFF000000,NULL,NULL,&tex_lpPlayer); The 12th parameter (0xFF000000) is the color to act as the color key. But know I dont load the textures from a file anymore but generate them and I dont know how to set the color kney of a newly created texture with loading a file. Please help I have trawled through the docs but as usual they are much use. Thanks inadvance. P.S. This is for asteroids which are now been generated mathmatically at run time and I am using the LPD3DXSPRITE interface. Thanks again.

Share this post


Link to post
Share on other sites
Here''s my *guess*:

When you specify a color key color, the D3DX.. function changes the alpha value for that pixel to zero.

Whether or not that''s true, you can do the same thing - instead of coloring pixels with a color key value, simply "color" them with an alpha value of 0.

Share this post


Link to post
Share on other sites
Thanks for the help. Sorry about my original post I did''nt read over the grammar etc it''s really messy. I have looked at all the tutorials at Hyenas website but they all deal with the fact that you are loading a texture, I''m not I create the texture with a little algorythm. I have tried using memset to set the color of the texture to the same as the color key parameter used in the D3DXCreateTextureFromFileExA(...) function but it does not seem to work. Thanks for the help anway.

Share this post


Link to post
Share on other sites
Hello again, I have got it working, it was because I was creating the wrong type of surface, so you you were right. Sorry about that and thanks.

Share this post


Link to post
Share on other sites