Wessel Posted November 13, 2005 Posted November 13, 2005 Hi!, I'm trying to render a rectangle with a transparent color. I made a vertexbuffer like this: CustomVertex.TransformedColored[] pVerts = new CustomVertex.TransformedColored[4]; //590; 494 GraphicsStream pStream = m_pVertex.Lock(0,0,0); pVerts[0].Position = new Vector4(Position.X+Size.Width,Position.Y,Position.Z,1.0f); pVerts[1].Position = new Vector4(Position.X+Size.Width,Position.Y+Size.Height,Position.Z,1.0f); pVerts[2].Position =new Vector4(Position.X,Position.Y+Size.Height,Position.Z,1.0f); pVerts[3].Position =new Vector4(Position.X,Position.Y,Position.Z,1.0f); pVerts[0].Color = BackColor.ToArgb(); pVerts[1].Color = BackColor.ToArgb(); pVerts[2].Color = BackColor.ToArgb(); pVerts[3].Color = BackColor.ToArgb(); pStream.Write(pVerts); m_pVertex.Unlock(); The BackColor defines a color with an alpha channel. When i try to render the vertexbuffer, no transparency is applied but the color is visible. The renderstate is defined like this: m_pDevice.RenderState.SeparateAlphaBlendEnabled = true; m_pDevice.RenderState.DestinationBlend = Blend.InvSourceAlpha; m_pDevice.RenderState.SourceBlend = Blend.SourceAlpha; Any ideas? Quote
DrunkenHyena Posted November 14, 2005 Posted November 14, 2005 m_pDevice.RenderState.SeparateAlphaBlendEnabled = true; m_pDevice.RenderState.DestinationBlend = Blend.InvSourceAlpha; m_pDevice.RenderState.SourceBlend = Blend.SourceAlpha; I think you want to set AlphaBlendEnable, not SeparateAlphaBlendEnabled. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.