Quaternion question...

Hi… I’ve created a working Quaternion class and all, and a function which takes a quaternion and a vector and rotates it through the matrix and all, etc etc. Anyway. I was wondering if there was a better way to do all this (possibly using OpenGL somewhere…?). Thanks!

The OpenGL API has no direct support for Quaternions.

You’ll need to turn your quaternion into a matrix or vector/angle for OpenGL.

Does that mean I should rotate my points with Quaternions then draw them? IE, run my function instead of glRotatef? Because hardware acceleration is coming to mind, and I’m wondering if Quaternions are worth it.

Another question that aroused is about Quaternions themselves. In the rotation matrix, is the inputted quaternion the result of qPq’? Or is it just q? I’m assuming I multiply the matrix by the vector I wanna rotate (ie Euler).

[Oh man, my English was horrible.]

[This message has been edited by 2 (edited 04-09-2001).]

As to using Quaternions with OpenGL, that’s pretty easy. Generate the rotation matrix from a Quaternion (that’s part of your library, right?) and then just call glMultMatrix.