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….
Also, if I switch my DrawIndexedPrimitives to DrawUserIndexPrimitives (using memory objects instead of vertex buffers) everything works fine… An acceptable solution would be to know how I can query the hardware to figure out if this will work or not work so that my code can conditionally use either memory objects or vertex buffers.
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
};
Switching from indicies resolved the issue although I still don’t know why it would..