void ofApp::draw(){
ofSetColor(255);
img_.bind();
ofMesh mesh;
int vx0 = 0; int vy0 = 0;int vx1 = 500; int vy1 = 500;
int tx0 = 0; int ty0 = 0;int tx1 = 500; int ty1 = 500;
mesh.addVertex(ofPoint(vx0, vy0)); mesh.addTexCoord(ofPoint(tx0, ty0));
mesh.addVertex(ofPoint(vx1, vy0)); mesh.addTexCoord(ofPoint(tx1, ty0));
mesh.addVertex(ofPoint(vx1, vy1)); mesh.addTexCoord(ofPoint(tx1, ty1));
mesh.addVertex(ofPoint(vx0, vy1)); mesh.addTexCoord(ofPoint(tx0, ty1));
mesh.addIndex(0); mesh.addIndex(1); mesh.addIndex(2);
mesh.addIndex(0); mesh.addIndex(3); mesh.addIndex(2);
mesh.draw();
img_.unbind();
}
I use this code to draw a part of an image. the problem is, if the texture coordinate is larger than the image size(tx1 in my code), it will just duplicate the image border. I want that it just uses solid color(say black) to fill that part. how could i do this?