Jump to content
  • Advertisement
Sign in to follow this  
int01h

glScalef() - Scales with strange pivot

This topic is 4351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, i have a scene which is rendered in this order: void Renderscene(){ glPushMatrix(); glTranslatef(0,0,0); for(int x=0;x<=100;x++){ for(int y=0;y<=100;y++){ auxWireCube(1); } } glPopMatrix(); } Now i would like this scene to be scaled so i do: void Renderscene(){ glPushMatrix(); glScalef(SCALE,SCALE,SCALE); glTranslatef(0,0,0); for(int x=0;x<=100;x++){ for(int y=0;y<=100;y++){ auxWireCube(1); } } glPopMatrix(); } When i glScalef() the scene, i get this scene scaled but it has a 'pivot' placed in 0,0,0 so everything is scaled to the 0,0,0 point. I would like the scene to be scaled to the actual position... I tried everything ;/ Any idea ? edit: No all caps subjects, its just rude. [Edited by - phantom on June 25, 2006 6:50:01 AM]

Share this post


Link to post
Share on other sites
Advertisement
Put the call to glScalef() after the call to glTranslatef() rather than before. This will have the effect of applying the scale transform before the translation, which is most likely what you're after.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
This will have the effect of applying the scale transform before the translation, which is most likely what you're after.


And just out of general principle and because I still hate that pointless "OpenGL is all backwards"-POV. It has the effect of applying it AFTER translating into position, because transformation are not just affecting "the object", but the whole local coordinate system. And translating along "scaled dimensions" obviously has a different result than translating first (and in the same way you usually translate FIRST and then rotate, because else you're translating along rotated axes).

Never saw the point in "protecting" people from having to understand the difference between local/object and global/world coordinates. Sooner rather than later they will have to figure it out, anyway. I'm getting a lot less headache from thinking in object space than from trying to imagine everything happening backwards. Especially as pretty much everyone that ever touched modelling software should be used to seeing small coordinate systems at/in/on their objects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!