Wessel
Newcomer
Hi!,
I'm trying to render a rectangle with a transparent color. I made a vertexbuffer like this:
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:
Any ideas?
I'm trying to render a rectangle with a transparent color. I made a vertexbuffer like this:
PHP:
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:
PHP:
m_pDevice.RenderState.SeparateAlphaBlendEnabled = true;
m_pDevice.RenderState.DestinationBlend = Blend.InvSourceAlpha;
m_pDevice.RenderState.SourceBlend = Blend.SourceAlpha;
Any ideas?