Jump to content
  • Advertisement
Sign in to follow this  
deadimp

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.

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->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)
 //D3DFVF_TLVERTEX - The vertex shader I'm using for textured quads
lpD3DDevice->SetVertexShader(D3DFVF_TLVERTEX);
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]

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!