@ -12,6 +12,11 @@ void ofApp::setup()
void ofApp::update()
{
ofBackground(0);
ofVec2f p;
p.x = ofRandomWidth();
p.y = ofRandomHeight();
triangleSurface.setVertex(0, p);
}
void ofApp::draw()
@ -9,6 +9,7 @@ public:
ofxBaseSurface();
virtual void setup(){};
virtual void draw(){};
virtual void setVertex(int index, ofVec2f p){};
protected:
ofMesh mesh;
@ -50,4 +50,14 @@ void ofxTriangleSurface::draw()
texture->bind();
mesh.draw();
texture->unbind();
void ofxTriangleSurface::setVertex(int index, ofVec2f p)
if ( index > 2 ) {
ofLog() << "Vertex with this index does not exist: " << index << endl;
return;
mesh.setVertex(index, p);
@ -13,6 +13,7 @@ public:
void setup();
void setup( ofVec2f p1, ofVec2f p2, ofVec2f p3, ofVec2f t1, ofVec2f t2, ofVec2f t3, ofTexture* texturePtr );
void draw();
void setVertex( int index, ofVec2f p );
};
#endif