Wednesday, December 15, 2010

new VertexBuffer() Xna3.1 -> Xna4.0

My latest errors seem to revolve a lot around vertex buffer api changes. There is  nice blog post here by Shawn Hargreaves.
Post about Vertex Buffer Changes

simply put though you remove your VertexDeclaration lines of code and just put 'typeof(RoundLineVertex)' the declaration in the second parameter of the VertexBuffer call, like these following two lines of code.
vb = new VertexBuffer(device, typeof(RoundLineVertex), numVertices * bytesPerVertex, BufferUsage.None);

// vdecl = new VertexDeclaration(device, RoundLineVertex.VertexElements);
 
After going through that it was very easy to change the VertexBuffer setups... Only now i have IndexBuffer to sort out. I did not write this original code and so have no real working knowlegde of the finer points required to make this stuff work. However I hope it wil be fairly straight forward once i under what has changed in the API. I understand what the buffer is for, only not whats changed at the moment.

Laters

No comments:

Post a Comment