Hello,
I have a little problem in DirectX 9 (using CSharp). I need to put a background(texture) to my scene. Everything work fine, my bitmap appear without problems. Im using a Quad to draw my texture on.
The problem appear when I try to draw other primitive (triangle) in front of my Quad (background).
There is some code:
The first time that I render this, I can see my first drawed triangles and after I can see my background. But the second time I render it, it's like if my triangles are now drawed. It seem to be the result of:
If I switch my code and draw my background first, I'll never see my triangles.
I really dont know what,s the problem there.
Thank for your help/hints about this problem.
Salutations,
I have a little problem in DirectX 9 (using CSharp). I need to put a background(texture) to my scene. Everything work fine, my bitmap appear without problems. Im using a Quad to draw my texture on.
The problem appear when I try to draw other primitive (triangle) in front of my Quad (background).
There is some code:
// The quad buffer.
vertexTexture = new VertexBuffer( typeof(CustomVertex.TransformedColoredTextured), 4, device, Usage.WriteOnly, CustomVertex.TransformedColoredTextured.Format, Pool.Default);
// Note: Im assigning my vertices correctly, I'll not post the code here.
device.BeginScene();
// There im trying to write some colored triangle.
for (int i = 0; i < LVRTSDisplay.SectorNumber;i++)
{
device.SetStreamSource( 0, vertexBuffer1, 0);
device.VertexFormat = CustomVertex.TransformedColored.Format;
device.DrawPrimitives(PrimitiveType.TriangleList, 0, (2 * LVRTSDisplay.ArcNumber));
}
device.SetStreamSource( 0, vertexTexture, 0);
device.VertexFormat = CustomVertex.TransformedColoredTextured.Format;
device.SetTexture(0, textureBackground);
device.DrawPrimitives(PrimitiveType.TriangleFan, 0, 2);
device.EndScene();
device.Present();
The first time that I render this, I can see my first drawed triangles and after I can see my background. But the second time I render it, it's like if my triangles are now drawed. It seem to be the result of:
device.SetTexture(0, textureBackground);
device.DrawPrimitives(PrimitiveType.TriangleFan, 0, 2);
If I switch my code and draw my background first, I'll never see my triangles.
I really dont know what,s the problem there.
Thank for your help/hints about this problem.
Salutations,