This is a question about noob, but I searched extensively and cannot find the answer.
I have two separate cells that need to be drawn in one window using DrawUserIndexedPrimitives. I use two instances of BasicEffect with their own views and projection matrices.
However, when they are rendered, one line is joined. XNA believes that they are part of the same grid. Do I need to use a separate instance of GraphicsDeviceManager for each of them? This does not seem right.
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.VertexDeclaration = declaration; effect.Begin(); effect.View = view; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, positions1, 0, positions1.Length, index1, 0, index1.Length / 3); pass.End(); } effect.End(); effect2.Begin(); effect2.View = view2; foreach (EffectPass pass in effect2.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, positions2, 0, positions2.Length, index2, 0, index2.Length / 3); pass.End(); } effect2.End(); base.Draw(gameTime); }
The last triangle at positions 1 connects to the first at positions 2.
Thanks for any help you can give.
source share