Creating the 3D city

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Creating_the_3D_city.php

In this tutorial we are just going to carry over some of the changes from the last one, since the only method we need to change is copied from it and extended.

So we change this line in the SetUpVertices() method:
cityVertexBuffer = new VertexBuffer(device, verticesList.Count * VertexPositionNormalTexture.SizeInBytes, BufferUsage.WriteOnly);

cityVertexBuffer.SetData (verticesList.ToArray());

to this:

cityVertexBuffer = new VertexBuffer(device, typeof(VertexPositionNormalTexture) ,verticesList.Count, BufferUsage.WriteOnly);

cityVertexBuffer.SetData(verticesList.ToArray());

And again remove this line:

texturedVertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements);

And that is all for this tutorial, next step Loading a model.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s