@pxt wrote:
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); mesh.addVertex(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?
Posts: 1
Participants: 1