Archived

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

EvilProgrammer

glScalef and collisions

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,

~Graham

Share this post


Link to post
Share on other sites