i'm drawing 3 object, they are created from the same class so they are identical.
i try to alter the color, so they have 3 different colors.
the result is that the color of the first object is used for the other object aswell.
this is some of the render function
myGraph[
0].GraphBorderColor = Color.Red;myGraph[
1].GraphBorderColor = Color.Green;myGraph[
2].GraphBorderColor = Color.Gray; for(int i=0;i<3;i++){
Vector3 grafdist =
new Vector3((float)i*10,(float)i*0,(float)i*10);Vector2 mousepos =
new Vector2(MouseMovedPoint.X,MouseMovedPoint.Y);SetupMatrices(grafdist, mousepos);//this sets up the view
myGraph
.StreamNum = i;//this sets up the stream for device.SetStreamSource
myGraph
.MakeScene();//this makes the scene
}
device.Present();
this is the function MakeScene():
this
.device.BeginScene(); device.VertexFormat = CustomVertex.PositionColored.Format;device.SetStreamSource(
this.StreamNum, this.vBuffer, 0);device.DrawPrimitives(PrimitiveType.TriangleStrip,
0, 5);//windowdevice.DrawPrimitives(PrimitiveType.LineList,
6, 4);//axisdevice.DrawPrimitives(PrimitiveType.LineList,
10, 40);//axis markersdevice.EndScene();
I look forward to hear from you.

multiple object with different colors
scjconsulting
Holzberg
here it is, i hope you can help:
public
class LineInterpolation2DGraph : Graph2DInterface{
private const int numVerts = 100; public LineInterpolation2DGraph(Device dev){
this.device = dev; this.InitGraf();}
public override bool InitGraf(){
this.XBins = 100; this.YBins = 30; this.BackGroundColor = Color.LightGray; this.GraphAboveColor = Color.WhiteSmoke; this.GraphUnderColor = Color.Brown; this.GraphBorderColor = Color.Black; this.AxisColor = Color.Green; this.GraphPlotDimention = new Rectangle(new Point(0,0),new Size(80,30)); this.GraphWindowDimention = new Rectangle(new Point(0,0),new Size(100,55)); this.PlotDistFromWindow_X = (GraphWindowDimention.Width - GraphPlotDimention.Width)/2; this.PlotDistFromWindow_Y = (GraphWindowDimention.Height - GraphPlotDimention.Height)/2; this.vBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), numVerts, this.device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Default); return true;}
public override void CreateDefaultVertex(){
int vertisCount = 2; CustomVertex.PositionColored[] verts = new CustomVertex.PositionColored[4];verts[
0].Color = Color.FromArgb(128,GraphBorderColor).ToArgb();verts[
0].Position = new Vector3(0,0,0);verts[
1].Color = Color.FromArgb(128,GraphBorderColor).ToArgb();verts[
1].Position = new Vector3(0,GraphWindowDimention.Height,0);verts[
2].Color = Color.FromArgb(128,GraphBorderColor).ToArgb();verts[
2].Position = new Vector3(GraphWindowDimention.Width,0,0);verts[
3].Color = Color.FromArgb(128,GraphBorderColor).ToArgb();verts[
3].Position = new Vector3 (GraphWindowDimention.Width,GraphWindowDimention.Height,0); this.vBuffer.SetData(verts,0,LockFlags.None);vertisCount +=
4; } public override void MakeScene(){
try{
this.CreateDefaultVertex(); this.device.BeginScene();device.VertexFormat = CustomVertex.PositionColored.Format;
device.SetStreamSource(
this.StreamNum, this.vBuffer, 0);device.SetRenderState( RenderStates.AlphaBlendEnable,
true );device.SetRenderState( RenderStates.SourceBlend, (
int)Blend.SourceAlpha );device.SetRenderState( RenderStates.DestinationBlend, (
int)Blend.InvSourceAlpha ); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 5);
device.EndScene();}
catch(InvalidCallException IvCEx){
throw IvCEx;}
}
}
snibbets
Ashok Debnath