Archived

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

D3D9 Colour Key Transparencies

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

hello all, I''m having a bit of (code)writers block.. This is something I''ve done 10x before in previous versions of Direct3D - but for some reason I really can''t crack it tonight I have a simple 2D tile game, magenta colour key (that is, where a tile has a magenta pixel it shouldn''t be drawn).. I''m sure it was just a case of doing the following: 1. Creating the texture with the colour key AND with a D3DFMT that has at least 1bit alpha (I''m using A8R8G8B8). 2. Set the 3 render states: - D3DRS_SRCBLEND = D3DBLEND_SRCALPHA - D3DRS_DESTBLEND = D3DBLEND_INVSRCALPHA - D3DRS_ALPHABLENDENABLE = TRUE 3. Render! Is there anything else to it? I''m sure its one little thing I''ve missed... and its really bugging me any chance you can give me a hand? cheers, Jack DirectX 4 VB: All you need for multimedia programming in Visual Basic Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
cheers for the tips... I''ll have a crack at it after lunch

I also found an old(er) piece of D3D9 code that uses transparent textures, so if the above doesn''t work, I''ll just compare the two projects line for line till it works...!

cheers
Jack

DirectX 4 VB: All you need for multimedia programming in Visual Basic
Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
doubt anyone cares right now... but just for future reference (or if anyone searches with similar problems in the future!) I solved the problem by using 32bit DDS textures authored using DXTex...

Seems like D3DX really didn''t want to load my bitmap correctly!

Jack

DirectX 4 VB: All you need for multimedia programming in Visual Basic
Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites