Advertisement Jump to content
Sign in to follow this  
Dean Johnson

[.net] C# DX9 and Alpha Sprites

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

what I have: A png file with alpha in the shape of a star. The only color in the png is black. My Vertex is defined with. CustomVertex.PositionColoredTextured I assign the texture and a color. I change the color of the sprite with this line. dxDevice.SetTexture(0, m_ParticleTexture); dxDevice.TextureState[0].ColorOperation = TextureOperation.Add; dxDevice.TextureState[0].ColorArgument1 = TextureArgument.TextureColor; dxDevice.TextureState[0].ColorArgument2 = TextureArgument.Diffuse; Also I have these device states dxDevice.RenderState.AlphaBlendEnable = true; dxDevice.RenderState.SourceBlend = Blend.SourceAlpha; dxDevice.RenderState.DestinationBlend = Blend.InvSourceAlpha; This all works fine. The sprites show up with the right color and with the alpha from the png. What I want to do now is have the alpha from the color in the Vertex define how much the rest of the sprite should show. Anyone know how to do this? Thanks ALSO how do I get the code box in this forum? Thanks Again

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!