I'm trying to render a tree made out of 2 rectangles intersecting in the center at a 90degree angle. The texture has an alpha channel but which ever rectangle gets rendered second causes a weird problem with the transparency.
Here is my rendering code:
public override void render(GraphicsDevice gd, Camera camera)
{
RasterizerState rs = new RasterizerState();
rs.CullMode = CullMode.None;
gd.RasterizerState = rs;
gd.BlendState = BlendState.AlphaBlend;
effect.CurrentTechnique = effect.Techniques["TexturedNoShading"];
effect.Parameters["xWorld"].SetValue(Matrix.CreateTranslation(position));
effect.Parameters["xView"].SetValue(camera.getViewMatrix());
effect.Parameters["xProjection"].SetValue(camera.getProjectionMatrix());
effect.Parameters["xTexture"].SetValue(m_texture);
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
gd.Indices = m_indexBuffer;
gd.SetVertexBuffer(m_vertexBuffer);
gd.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, m_vertices.Length, 0, m_indices.Length / 3);
}
rs = new RasterizerState();
rs.CullMode = CullMode.CullCounterClockwiseFace;
gd.RasterizerState = rs;
gd.BlendState = BlendState.Opaque;
}