Reputation: 1231
I drew some quad like this with OpenGL:
_______ _______
| || |
| || |
| || |
|_______||_______|
currently I draw second quad using firstQuad.pos.x + width which is calculated manually.but when I want to scale them in at center point, I was wondering is it the right way to use calculated value, or use glTranslatef one by one, then glTranslatef to center of them, then use glScalef to scale them in? or how to do it right?
Upvotes: 1
Views: 1231
Reputation: 776
Unless you are updating quad's position firstQuad
according to your transformations, yes, you will have to use the GL matrix manipulation functions as you described. I'm assuming you are using legacy GL here (2.1 and older), modern releases no longer provide matrix manipulation functions.
What you must understand is that a GL transformation must be seen as a transformation on the base and origin that will be used for further draw calls, until reset to a previous state with glPopMatrix()
.
Upvotes: 1