Jump to content
  • Advertisement
Sign in to follow this  
Not Registered

Is there Quaternion class for opengl users ??

This topic is 4734 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 working on a quat class which I hope to make available when it's done, but it might be a while yet. Meanwhile, here are a couple of tips on how to make your own quat class OpenGL-friendly. The first thing to do is to define multiplication in the 'standard' way, i.e.:
q1q2 = [w1w2-v1.v2, w1v2+w2v1+v1Xv2]
With this form, quaternion concatenation mirrors matrices with column vectors, i.e. the quaternion product q2q1 applies q1 first, followed by q2. This is as opposed to DirectX, which uses 'reverse' quaternion multiplication (v2Xv1 instead of v1Xv2) to mirror the row-vector convention.

The only other OpenGL-specific thing I can think of right now is how you convert the quaternion to a matrix. To be lazy and skip over the details, there are basically only two ways to convert a (unit-length) quaternion to a rotation matrix, and they are transposes of each other. To make a long story short, if your current version doesn't give you the results you expect, transpose the indices in the code.

I think that should about do it, but feel free to ask if you have other questions.

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.

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!