Question

Does anyone know if it's possible to fill a mesh with the colors from the vertices?

My code so far draws a triangle and colors the vertices. Just no idea on how to fill it. I tried the add OF_MESH_FILL to mesh.draw() but doesn't seem to work. Thoughts?

ofVec3f top(100.0, 50.0, topZ);
ofVec3f left(50.0, 150.0, leftZ);
ofVec3f right(150.0, 150.0, rightZ);

mesh.addVertex(top * 4);
mesh.addColor(ofFloatColor(1.0, 0.0, 0.0));

mesh.addVertex(left * 4);
mesh.addColor(ofFloatColor(0.0, 1.0, 0.0));

mesh.addVertex(right * 4);
mesh.addColor(ofFloatColor(1.0, 1.0, 0.0));

mesh.draw(OF_MESH_FILL);
gui.draw();
Was it helpful?

Solution

Of course I had setMode in my setup running. Durr.

mesh.setMode(OF_PRIMITIVE_LINE_LOOP );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top