@br0mid wrote:
I have a border that gets drawn using the translation, rotation and scale transformations of an image. The border and the image match up perfectly when I rotate without any scale. However, once I scale the image and begin rotating an offset begins to grow between the image and the border and gets more severe as the angle increases. After a full rotation, the image and border match up again. Can’t think of what I’m doing wrong here.
ofPushMatrix(); ofSetColor(255,255,255); ofTranslate(pic->imageCenter.x, pic->imageCenter.y); ofScale((pic->width/pic->image.getWidth()), (pic->height/pic->image.getHeight()), 0); ofRotateZRad(pic->angle); pic->image.draw(-1*pic->image.getWidth()/2, -1*pic->image.getHeight()/2); ofPopMatrix(); ofPushMatrix(); ofTranslate(pic->imageCenter.x, pic->imageCenter.y); ofRotateZRad(pic->angle); ofSetColor(0,0,255); ofNoFill(); ofSetLineWidth(3); ofDrawRectangle(-1*pic->width/2, -1*pic->height/2, pic->width, pic->height); ofPopMatrix();
Posts: 1
Participants: 1