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

This topic is 4812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
lpD3DDevice->SetRenderState(D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA);
lpD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
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)
lpD3DDevice->SetTexture(0,[texture]);
//I'm using DrawPrimitiveUP on textured quads, and DrawPrimitive on primitive shapes. Would that affect anything?


The tutorial I am using: http://www.gamedev.net/reference/articles/article1608.asp 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]

1. 1
2. 2
JoeJ
17
3. 3
4. 4
frob
11
5. 5

• 13
• 16
• 13
• 20
• 13
• ### Forum Statistics

• Total Topics
632181
• Total Posts
3004625

×