Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Scaling a mesh centred anchor point (ofMesh ofScale ofTranslate)

$
0
0

@antocreo wrote:

Hi
I am trying to scale a ofMesh using as anchor point its centroid.
The mesh has a video as texture and it is not a regular shape.
I have initially tried to use pushMAtrix() ofScale() and ofTransalte()

float scalefactor = 1;
    
ofPushMatrix();
ofTranslate(-centroid);
ofScale(scalefactor,scalefactor);
video.getTextureReference().bind();
mesh.draw();
video.getTextureReference().unbind();
ofPopMatrix();

however it doesn't keep the anchor point centred.

I then tried to multiply each vertex * the scale factor but the result was similar.

Also for some reason if the scalefactor is = 2 I get a more centred result than if it is 1.

I think I am missing some basic here...
Is anyone able to help me with this please?

THanks!

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929