Jump to content
  • Advertisement
Sign in to follow this  
cozzie

OpenGL Quaternions, just more math?

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

Hi. After reading into some quaternions articles and tutorials, I think I get what they do and how they do it. But for as far I've read by now they have no advantage using them in my OpenGL camera, instead of using my own 3 rotation values and glRotatef. (they only expand your glmath.cpp ;-)) Can someone explain to me what the advantages of a quaternion camera are? (likewise for quaternion rotations for my objects) Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Gimbal lock is a problem of parameterization, not representation. If you create a rotation by multiplying quaternions representing euler angles you'll still suffer from gimbal lock.

The benefits of quaternions:

i) Smaller representation (4 vs 9 or 16 values) - maybe useful for storage or transmission.

ii) Interpolation. Try interpolating smoothly between rotations represented by matrices. You can't (at least not robustly and easily).

iii) Easy normalization. If you perform long strings of concatentations your final value is likely to be unnormalized (i.e. a rotation-plus-scale). While you can normalize matrix representations it is far easier to do it with quaternions.

There are probably other benefits but these are the main ones for gfx/game programming. Of course there are also downsides, and you'll eventually have to convert to matrix rep anyway for GPUs.

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!