Hi there, MeshBuilder is a part of the content pipeline, which depends on MsBuild. And due the way in which the mechanism works, it is only supposed to be used within the content pipeline (or a pipeline extension library), the information that MeshBuilder creates is intended for either the built in model processor, or your own custom processor. If you wish to be able to build the equivalent of the functionality ModelMesh provides, you may have to do this yourself, however there are plenty of tutorials on the internet that will show you how to do this.
Just incase this is new to you, here is a quick checklist for achieving this:
- Create an array of vertices (VertexPositionColor is one, but you can use other presets, and even create your own type).
- Create an array of indices for faces, it's normal to have them in multiples of 3, and each index refers to a vertex.
- In your draw call, call one of the appropriate Draw... methods, here's a quick example:
public class Game1 : Game
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
protected override void LoadContent()
vbo = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 3, BufferUsage.WriteOnly);
new VertexPositionColor(Vector3.Up, Color.White),
new VertexPositionColor(Vector3.Down + Vector3.Right, Color.Blue),
new VertexPositionColor(Vector3.Down + Vector3.Left, Color.Red)
float aspectRatio = GraphicsDevice.Viewport.AspectRatio;
shader = new BasicEffect(GraphicsDevice);
shader.World = Matrix.CreateScale(0.5f);
shader.View = Matrix.CreateLookAt(Vector3.Backward, Vector3.Zero, Vector3.Up);
shader.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, aspectRatio, 0.1f, 2);
protected override void Draw(GameTime gameTime)
GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 1);
Edited by AmzBee, 05 October 2012 - 04:37 PM.