Hi there. I’m drawing some custom shapes using ofPath
and I would like to update their scale and rotation every frame. The translate
, rotate
and scale
methods of ofPath
don’t save the transform and I’m having a hard time drawing things in the right place.
A stripped-down version of my code:
class myShape{
ofPath path;
float angleOffset = 0.0;
myShape(ofPoint pos);
void update();
void render();
}
myShape(ofPoint pos){
path.curveTo(0, 0);
//...
//...Fancy shape being drawn
//...
path.close();
path.translate(ofPoint(pos.x, pos.y)); //This works as expected
}
void myShape::update(){
angleOffset ++;
path.rotate(angleOffset, ofVec3f(0, 0, 1)); //This rotates the shape around (0, 0) instead of around (pos.x, pos.y)
}
void myShape::render(){
path.draw();
}
Any hints? I have to draw thousands of these shapes, so in order to have better performance I’m using ofPath
, which I guess is faster than ofBeginShape()