Draw and Set color of each vertex

So, im really looking for the equivalent of this processing code in openframeworks :

void setup() {
  size(600, 600, P2D);
}

void draw() {
  beginShape();
  fill(255, 0, 0);
  vertex(0, 0);
  fill(0, 255, 0);
  vertex(width, 0);
  fill(0, 0, 255);
  vertex(width, height);
  fill(255, 255, 0);
  vertex(0, height);
  endShape();
}

As you can see processing lets me paint each vertex and calculates the degrade between vertexs.

i´ve tryed several codes in openframeworks using ofPolyline and ofPath but without succes. Is there any way to accoplish this using openframeworks?

Hi,
You can check ofBook, Basics of Generating Meshes from an Image, which uses ofMesh.
This is from there:

void ofApp::setup() {
    mesh.setMode(OF_PRIMITIVE_POINTS);
    mesh.enableColors();

    ofVec3f top(100.0, 50.0, 0.0);
    ofVec3f left(50.0, 150.0, 0.0);
    ofVec3f right(150.0, 150.0, 0.0);

    mesh.addVertex(top);
    mesh.addColor(ofFloatColor(1.0, 0.0, 0.0)); // Red

    mesh.addVertex(left);
    mesh.addColor(ofFloatColor(0.0, 1.0, 0.0)); // Green

    mesh.addVertex(right);
    mesh.addColor(ofFloatColor(1.0, 1.0, 0.0)); // Blue
}