Aliii
05-28-2012, 02:32 PM
Im working on a program where I can move around with the camera in the "world" and draw objects. All objects have a position ...a pivot point.
I draw this way:
----------------
glLoadIdentity();
glRotate( ...camera orientation);
glTranslate( ...camera position);
drawOtherStuff1();
For( every object){
glPushMatrix();
glTranslate( ...object position);
drawObject();
glPopMatrix();
}
drawOtherStuff2();
----------------
Now this seems to be OK, however I want to scale the objects and I dont know where(and how) to put glScale. I guess I should scale the matrix before I translate and/or rotate it with the camera position and orientation. Should I call a pushMatrix() after the first loadIdentity, then pop it back and scale-rotate-translate before every drawObject() method?
Thanks!
(Plus: In the near future I want to add rotation to the objects, so if you can give any information or link on that, thats appreciated too)
I draw this way:
----------------
glLoadIdentity();
glRotate( ...camera orientation);
glTranslate( ...camera position);
drawOtherStuff1();
For( every object){
glPushMatrix();
glTranslate( ...object position);
drawObject();
glPopMatrix();
}
drawOtherStuff2();
----------------
Now this seems to be OK, however I want to scale the objects and I dont know where(and how) to put glScale. I guess I should scale the matrix before I translate and/or rotate it with the camera position and orientation. Should I call a pushMatrix() after the first loadIdentity, then pop it back and scale-rotate-translate before every drawObject() method?
Thanks!
(Plus: In the near future I want to add rotation to the objects, so if you can give any information or link on that, thats appreciated too)