// create
meshModel = g.createShape();
meshModel.beginShape(PConstants.TRIANGLE_STRIP);
meshModel.texture(texture);
for (int i = 0; i < vertices.size(); i++) {
PVector vert = vertices.get(i);
PVector tcoord = texCoords.get(i);
if (g.is3D()) {
PVector norm = normals.get(i);
meshModel.normal(norm.x, norm.y, norm.z);
meshModel.vertex(vert.x, vert.y, vert.z, tcoord.x, tcoord.y);
} else {
meshModel.vertex(vert.x, vert.y, tcoord.x, tcoord.y);
}
}
meshModel.endShape();
} else {
// update using setter methods
meshModel.setTexture(texture);
for (int i = 0; i < vertices.size(); i++) {
PVector vert = vertices.get(i);
PVector tcoord = texCoords.get(i);
if (g.is3D()) {
PVector norm = normals.get(i);
meshModel.setNormal(i, norm.x, norm.y, norm.z);
meshModel.setVertex(i, vert.x, vert.y, vert.z);
} else {
meshModel.setVertex(i, vert.x, vert.y);
}