 # Help building a shape (ofMesh-TexCoord)

Hello!
Im trying to build a shape…and i have several doubts… the objective is to draw irregular shapes with texCoordinates, in order to use per fragment shading.

first of all:

why using beginShape and endShape the shape is “close” ?
lets say i ve this formula to make a circle:

``````ofMesh mesh;

vector<glm::vec3>points;

mesh.setMode(OF_PRIMITIVE_LINE_LOOP);

for(int i = 0; i <= 360; i++){
float pct = i / (float) 360;
float angle = TWO_PI * pct;
float s = sin(angle);
float c = cos(angle);
ofColor f(ofRandom(255), i, 0);
ofSetColor(f);
glm::vec3 temp2= glm::vec3(0, 0, 0);

glm::vec3 temp = glm::vec3(s*100, c*100, 0);

points.push_back(temp);

}
``````

if i draw it using beginShape…

``````    ofBeginShape();
for(glm::vec3 p : points){
ofVertex(p);
}
``````

it result in a filled circle.
but if draw the ofMesh…

` mesh.draw();`

i only get the countourn.
why this? i understand that if i add a extra vertex in the center of the circle, then i can fill the shape.
its possible to create TexCoordinates with beginShape(); and endShape(); ?

i would like to think in a context where i can draw with polylines tangents and normals, and ofMesh (or vboMesh? ) to filled with shaders.
what do you think?

any hint?

Hey

Generating meshes can be a bit of a pain, why not use ofPath like

``````ofPath path;

for(int i = 0; i <= 360; i++){
....
path.lineTo(temp);
}
``````

then you can either go

`path.draw()`

or

``````ofMesh mesh = path.getTessellation()
mesh.draw()
``````

you can add tex coords if you create a function that maps each vertex in the mesh to whatever tex coord you want then call mesh `addTexCoords(const vector &tCoords)`

If it helps - I did a tutorial and demo code on how to manually make meshes and triangulate them

?