Advertisement Jump to content
Sign in to follow this  

D3D8 Textured Quads - Color Keying not Working Properly? (SOLVED)

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

I am trying to acheive a transparent color in my sprite, yet whenever I render it, it always draws the sprite with black where the transparency should be. However, this does not happen in the tutorial I got my code from (and the settings). The sprite's format does contain an alpha channel (D3DFMT_A8R8G8B8), and I do know that D3D is acquiring the color needed for keying (or however one would say that). Would this have anything to do with drawing primitive shapes in between? [Note: I am setting the textures to empty when drawing a primitive shape] I'll go ahead and post my settings for drawing:
//This is in the initial code:
lpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
//Enable alpha blended transparency.
lpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
lpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
lpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);]

//This is called each time a texture is drawn (well, each time it is needed)
 //D3DFVF_TLVERTEX - The vertex shader I'm using for textured quads
//I'm using DrawPrimitiveUP on textured quads, and DrawPrimitive on primitive shapes. Would that affect anything?

The tutorial I am using: I have another question about mirroring/flipping textured quads using matrix math (the method R. Parker uses), scaling, yet it is so frickin' wierd I don't know how to even state the problem. I'll probably try if this one gets solved. NOTE: That isn't incentive for you to try and mess me up [smile] EDIT: Here is an example screen shot: EDIT (again): Nevermind. I figured it out, ended up being somewhere in switching from drawing shapes to textured quads. [Edited by - deadimp on June 17, 2005 4:39:53 PM]

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!