Jump to content
  • Advertisement


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


OpenGL Matrix math for OPENGL

This topic is 6938 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've been stuck on this particular routine for a couple of weeks now and I need help.

The routine I need is a function that would calculate a 4x4 rotation matrix in opengl around an arbitrary point (vertex T(x,y,z,w)) based on a previous matrix. Something like

function RotateAroundAoint(point,angx,angy,angz,matrix): matrix.

for example:








So if somebody could help me with some code or an precise idea how I could do this I would really appreciated it.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Are you just doing this for rendering purposes? For stuff like weighed verticies and collision detection, you might need to calculate your own matrix, but for the rendering you should let openGL do it. Right now only GeForce would accelerate it but you still want to keep things in the GL pipeline if possible.

If the order isn't extremely important, you just do the transformation and rotations at the arbitrary point BEFORE your other transformations:

glRotatef(...) // X-axis
glRotatef(...) // Y-axis
glRotatef(...) // Z-axis


// from your code

and this will achieve the same effect. If you absolutely positively have to rotate around the point after the fact, I believe you could load the matrix into memory, loadIdentity(), perform transformation/ rotation, and then multiply the matrix by the one stored in memory(although I haven't tried it out.)

Good luck.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!