Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


glScalef and collisions

This topic is 5523 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

I''m pretty new to OpenGL programming and I have a question. It seems that if I was making a game and I wanted to change the size of an object, I might use glScalef function. However, from what I can tell this function does not permanently change the vertex coordinates of the object. So if my object appeared 1/2 size, or x2 size, it would still have the same collision radius because the vertex coordinates would be the same. Am I wrong in my assessment, or should I just write my own scaling function that changes the actual vertex coordinates? I probably should have tested this out myself, but I''m just wondering if there''s some other way to scale or check collisions.

Share this post

Link to post
Share on other sites
glScalef only modifies vertex coordinates as they are sent to OpenGL. In your code they are one set of values, after glScalef, OpenGL sees the scaled version, so what is drawn isn''t accurate to your collision detection. You should write your own scaling function to actually change the values. If you don''t need to have a different scale value every frame it would be better this way too because you can scale before you start drawing and not waste processor cycles rescaling every frame.

Hope that helps,


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!