Hello, I’ve recently become interested in mesh, so I’m studying while looking at examples of openframeworks.

One of the examples is a code that gives index to vertex.

```
int width = vidGrabber.getWidth();
int height = vidGrabber.getHeight();
//add one vertex to the mesh for each pixel
for (int y = 0; y < height; y++){
for (int x = 0; x < width; x++){
mainMesh.addVertex(glm::vec3(x,y,0));
mainMesh.addColor(ofFloatColor(0,0,0));
}
}
for (int y = 0; y<height-1; y++){
for (int x=0; x<width-1; x++){
mainMesh.addIndex(x+y*width); // 0
mainMesh.addIndex((x+1)+y*width); // 1
mainMesh.addIndex(x+(y+1)*width); // 10
mainMesh.addIndex((x+1)+y*width); // 1
mainMesh.addIndex((x+1)+(y+1)*width); // 11
mainMesh.addIndex(x+(y+1)*width); // 10
}
}
```

There’s something I’m curious about in this code.

- Why are we doing “y<height-1” instead of “y<height”?

2.I don’t know why there are patterns of 0, 1, 10 and 1, 11, 10 in the process of giving index to vertex.

I’m curious about the mathematical reason why you get that pattern by multiplying your width.

I’d appreciate it if you could answer.