# Help building a ofVbo mesh

Hi,

I am trying to build a simple ofVbo mesh, find my results in the attach image, I believe I am calculating the indices correctly, but looks like the indices are not matching the vertices positions

This is my code

``````
mTotalVertices	= GRID_ROWS * GRID_COLUMS;
mTotalTriangles	= ((GRID_ROWS - 1) * (GRID_COLUMS - 1)) * 2;
mTotalIndices	= mTotalTriangles * 3;

mParticleSize	= 8.0f;

int spaceX		= GRID_WIDTH  / GRID_ROWS;
int spaceY		= GRID_HEIGHT / GRID_COLUMS;

mGridCenterX	= ((GRID_ROWS	- 1) * spaceX) / 2;
mGridCenterY	= ((GRID_COLUMS - 1) * spaceY) / 2;

GLuint indices[mTotalIndices];

int ind = 0;

for ( int i = 0; i < GRID_ROWS; i++ ) {
for ( int j = 0; j < GRID_COLUMS; j++ ) {
// calc indices
int a, b, c, d, e, f;
if ( (i + 1 < GRID_ROWS) && (j + 1 < GRID_COLUMS) ) {
a = (i + 0) * GRID_COLUMS + (j + 0);
b = (i + 0) * GRID_COLUMS + (j + 1);
c = (i + 1) * GRID_COLUMS + (j + 0);

d = (i + 0) * GRID_COLUMS + (j + 1);
e = (i + 1) * GRID_COLUMS + (j + 1);
f = (i + 1) * GRID_COLUMS + (j + 0);

indices[ind]   = a;
indices[ind+1] = b;
indices[ind+2] = c;

indices[ind+3] = d;
indices[ind+4] = e;
indices[ind+5] = f;

ind += 6;
}

// calc vertices positions
int index	= i + j * GRID_ROWS;
int x		= i * spaceX;
int y		= j * spaceY;
int z		= 0;

vertices[index].set( x, y, z );
}
}

// Set shape indices
shape.setIndexData( indices, mTotalIndices, GL_STATIC_DRAW );
shape.setVertexData( vertices, mTotalVertices, GL_DYNAMIC_DRAW );

``````

And this is how I draw

``````
shape.bind();
shape.updateVertexData( vertices, mTotalVertices );
shape.draw( GL_TRIANGLES, 0, mTotalVertices );
shape.unbind();

``````

This are my ofVbo indices,
**total vertices: 16
total triangles: 18
total indices: 54
indices: 0
indices: 1
indices: 4
indices: 1
indices: 5
indices: 4
indices: 1
indices: 2
indices: 5
indices: 2
indices: 6
indices: 5
indices: 2
indices: 3
indices: 6
indices: 3

**