Jump to content
  • Advertisement

Archived

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

EvilProgrammer

glScalef and collisions

This topic is 5611 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
Advertisement
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,

~Graham

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!