Blackelfwolf

Blackelfwolf

  • NA
  • 1
  • 15.2k

VertexDecleration problem XNA

Nov 22 2010 12:54 AM

Hi I've got this book here that teaches you how to use XNA game studio. There is a part which I don't understand. It says: 


VertexDeclaration

VertexDeclaration object stores the vertex format for the data contained in each vertex of the shape or model. Before drawing the object , the graphics device must be set to use the correct format to allow for proprt retrieval of vertex data from each vertex array. Here is the syntax required to declare and initialize the VertexDeclaration object:

VertexDeclaration vertexDeclaration

= new VertexDeclaration( GraphicsDevice gfx.GraphicsDevice,                                                                                                VertexElement[] elements) ;

Before and object is drawn, the graphics device's VertexDeclaration property is assigned so that it can retrieve the vertex data and render it properly:

gfx.GraphicsDevice.VertexDeclaration = vertexDecleration;


Blue: Text in book

Red: Code

Any Idea Where I put this code?

I've included my Source code.



Attachment: WindowsGame2.zip

Answers (1)