How to scale a quad from the center

Hi

I need to reescale a simple quad, but I need to reescale from the center to the borders instead of reescaling to the right down corner.

This is what i do :

  • Each quad has his own model matrix where are stored all the geometric transformations. (initialized with the identity)
  • I translate the coordenate system ( model ) to 100,100 and I print a quad there by doing:
  
  
glpushMatrix();  
glMatrixMode( GL_MODELVIEW);  
glMultMatrixf ( my_model_matrix )  
ofRect(0,0,scale*SIZE, scale*SIZE);  
glPopMatrix();  
  

So I obtain a quad where the left upper corner is situated to 100,100 in my world coordinates.

Then if I scale the model, I obtain the quad scaled but the left upper corner remains in 100,100, and I would like to get a realistic effect and scale from the center to the quad borders.

I know that typically if you want to make any transformation you need to translate the center of the quad to your 0,0, then scale/rotate, and finally translate your quad center to 100,100.

I’m a bit confused :slight_smile:

I have solved the problem :smiley:

I had to draw my quad in the middle of my model’s coordinate system. And that’s all