glScalef and collisions

Started by
2 comments, last by EvilProgrammer 20 years, 8 months ago
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.
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
That answers my question. Thanks!
No problem =)

~Graham

[edited by - gwihlidal on August 9, 2003 11:26:11 PM]

This topic is closed to new replies.

Advertisement