XNA Reach profile with VMWare - Vertex Buffers not working?

Posted by Nektarios on Stack Overflow See other posts from Stack Overflow or by Nektarios
Published on 2010-12-29T05:48:21Z Indexed on 2010/12/29 5:53 UTC
Read the original article Hit count: 471

Filed under:
|
|

Running XNA app, using Reach profile, in VMWare Fusion host OS Mac OSX, VM is Windows XP SP 3 (my dual-boot OS). Running on MacBook Pro w/NVidia 320M graphics card

When I am booted in to XP natively, my code works. The code is drawing cubes that are set up using vertex buffers

When another friend runs this same code on Windows 7, it also works for him just fine

When I am running my code in the VM, it doesn't work. I have billboarding sprites running in a shader program and this part displays fine. I get no crashing or errors, the geometry just doesn't appear. I tried Debug and Release. This is very basic operation so I'm thinking VMWare isn't the problem, but it's my code....

My init code:

  var vertexArray = verts.ToArray();
  var indexArray = indices.ToArray();

  indexBuffer = new IndexBuffer(GraphicsDevice, typeof(Int16), indexArray.Length, BufferUsage.WriteOnly);
  indexBuffer.SetData(indexArray);

  vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), vertexArray.Length,
    BufferUsage.WriteOnly);
  vertexBuffer.SetData(vertexArray);

My Draw code:

 // problem isn't here, tried no cull
  GraphicsDevice.RasterizerState = RasterizerState.CullClockwise;
  GraphicsDevice.BlendState = BlendState.AlphaBlend;
  GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };
// Update View and Projection
  TileEffect.View = ((Game1)Game).Camera.View;
  TileEffect.Projection = ((Game1)Game).Camera.Projection;

  TileEffect.CurrentTechnique.Passes[0].Apply();

  GraphicsDevice.SetVertexBuffer(vertexBuffer);
  GraphicsDevice.Indices = indexBuffer;

  GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, indices.Count, 0, indices.Count / 3);

For LoadContent:

 TileEffect = new BasicEffect(GraphicsDevice)
  {
    World = Matrix.Identity,
    View = ((Game1)Game).Camera.View,
    Projection = ((Game1)Game).Camera.Projection,
    VertexColorEnabled = true
  };

© Stack Overflow or respective owner

Related posts about c#

Related posts about XNA