Original Post
Hi Could someone tell me why this code is not working???
Graphic.global.device.RenderState.ZBufferEnable=false;
Graphic.global.device.RenderState.ZBufferWriteEnable=false;
Graphic.global.device.SetTexture(0,t1);
Graphic.global.device.TextureState[0].ColorOperation=TextureOperation.Modulate;
Graphic.global.device.TextureState[0].ColorArgument1=TextureArgument.TextureColor;
Graphic.global.device.TextureState[0].ColorArgument2=TextureArgument.Diffuse;
Graphic.global.device.TextureState[0].AlphaOperation=TextureOperation.Disable;
Graphic.global.device.RenderState.AlphaBlendEnable=false;
Graphic.global.device.SetStreamSource(0,vb1,0);
Graphic.global.device.VertexFormat=CustomVertex.TransformedTextured.Format;
Graphic.global.device.DrawPrimitives(PrimitiveType.TriangleList,0,2);
Graphic.global.device.SetTexture(0,t2);
Graphic.global.device.TextureState[0].ColorOperation=TextureOperation.Modulate;
Graphic.global.device.TextureState[0].ColorArgument1=TextureArgument.TextureColor;
Graphic.global.device.TextureState[0].ColorArgument2=TextureArgument.Diffuse;
Graphic.global.device.TextureState[0].AlphaOperation=TextureOperation.SelectArg1;
Graphic.global.device.TextureState[0].AlphaArgument0=TextureArgument.TextureColor;
Graphic.global.device.TextureState[0].AlphaOperation=TextureOperation.SelectArg2;
Graphic.global.device.TextureState[0].AlphaArgument1=TextureArgument.Current;
Graphic.global.device.RenderState.AlphaBlendEnable=true;
Graphic.global.device.RenderState.SourceBlend=Blend.SourceAlpha;
Graphic.global.device.RenderState.DestinationBlend=Blend.InvSourceAlpha;
Graphic.global.device.SetStreamSource(0,vb2,0);
Graphic.global.device.VertexFormat=CustomVertex.TransformedTextured.Format;
Graphic.global.device.DrawPrimitives(PrimitiveType.TriangleList,0,2);
It draw two rectangles (from two triangles) and the second (smaller) should be transparency. But it is not. What is wrong? Or could someone show me working picece of code drawing Transparency rectangle (texture with no alpha channel). Graphic.global.device is Direct3D.Device object.