Hi all,
Here is the relevant bits of code....
//Declare matrix
private Matrix View, Projection, View2, Projection2, HalfProjection
//Declare camerapos
private Vector3 cameraPosition = new Vector3(-0.1565399f, 117.545f, -71.0242f);
//declare additional viewports (as per MS sample)
Viewport singlePlayer;
Viewport leftView, rightView;
//in load graphics content
Viewport port = graphics.GraphicsDevice.Viewport;
//the view matrix represents the user eye view
View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
//Projection view is what the user will see
Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), (float)port.Width / port.Height, 1.0f, 10000.0f);
//Half view projection matrix
HalfProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), (float)port.Width / port.Height, 1.0f, 10000f);
//Camera 2's properties
View2 = View;
Projection2 = Projection;
//Viewport configuration
singlePlayer = graphics.GraphicsDevice.Viewport;
leftView = singlePlayer;
rightView = singlePlayer;
//Split the screen horizontally
leftView.Width = leftView.Width / 2;
rightView.Width = rightView.Width / 2;
rightView.X = leftView.Width + 1;
//end of loadcontent
//in the draw method
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.Black);
//Draw left view port
graphics.GraphicsDevice.Viewport = leftView;
UpdateCamera(View1, Projection1);
//Draw the right viewport
graphics.GraphicsDevice.Viewport = rightView;
UpdateCamera(View2, Projection2);
base.Draw(gameTime);
}
//end of draw
//in the update camera
private void UpdateCamera(Matrix View, Matrix Projection)
{
transforms = new Matrix[tempAnim.Model.Bones.Count];
foreach (ModelMesh mesh in tempAnim.Model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.View = View;
effect.Projection = Projection;
}
}
}
I have tried to use the HalfProjection matrix (which results in a totally blank screen) when drawing.
I really hope it's something obvious and nooby.....
Thanks for all the help....
Corpse.