Jump to content

  • Log In with Google      Sign In   
  • Create Account

Kyle Brechin

Member Since 16 Jan 2011
Offline Last Active Jun 09 2015 08:44 PM

Topics I've Started

How to make multiple rectangles?

27 January 2011 - 11:40 AM

I keep having to read over the sections initializing and setting up the indices, vertex, and index buffer. I find the concept a little intimidating code wise, though the concept isn't hard.

I'd like to try to do something to better help my understanding by taking the original rectangle that was made and setting up two more along the left and right side.

1st rect vetexes:



Now, what I can't grasp is after I create these points, do try have to be made in order? Or following the culling rules? Can I put the drawing in the same effect start and end? How so I properly I initialize this in the vertex and index buffer?

I'm trying to grasp the concept of how and why but I'm not getting enough answers from the book.

Vertices assignment confusing

16 January 2011 - 03:11 PM

I'm trying to understand what the point of assigning these values to the indices are.

He's simple using two triangles to create a rectangle on the screen which is simple enough to understand, but the InitializeIndices() method confuses me because I don't understand why he's assigning the value. I also understand that he's adding the vetices in a clockwise manner

It's from Sams Microsoft xna unleashed (isbn 978-0-672-23964-7)

Ignore any typos or small syntax errors, im on my phone.

In LoadGraphicsContent:

private void InitializeIndices()


indices = new short[6];

Indices[0] = 0;

indices[1] = 1;

indices[2] = 2;

Indices[3] = 0;

indices[4] = 3;

indices[5] = 1;


If any more code is needed, just let me know.

Im looking for the "why" answer. I just cant understand it without knowing how it works.