문제

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();
도움이 되었습니까?

해결책

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

mesh.setMode(OF_PRIMITIVE_LINE_LOOP );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top