WhatEver 125 Report post Posted January 27, 2001 Does anyone know how to do this. I read the Dian Grubber artical but I don''t undertsnad those formulas, much less implimenting it in OpenGL. I want to use the method so I can start using bones in my models. 0 Share this post Link to post Share on other sites
warpexplorer 122 Report post Posted January 28, 2001 First you need to know how to multiply matrices, or at least know how to do it in openGL. But assuming that you already know how to do that, here is how you rotate around an arbitrary axis given by a vector(note: this assumes the vector has a length of one)angle = the amout of rotation (usually in radians)v = vector that is rotated aroundc = cos(angle);s = sin(angle);matrix[0][0] = (v.x * v.x) * (1.0f - c) + cmatrix[0][1] = (v.y * v.x) * (1.0f - c) + (v.z * s)matrix[0][2] = (v.z * v.x) * (1.0f - c) - (v.y * s)matrix[0][3] = 0matrix[1][0] = (v.x * v.y) * (1.0f - c) - (v.z * s)matrix[1][1] = (v.y * v.y) * (1.0f - c) + cmatrix[1][2] = (v.z * v.y) * (1.0f - c) + (v.x * s)matrix[1][3] = 0matrix[2][0] = (v.x * v.z) * (1.0f - c) + (v.y * s)matrix[2][1] = (v.y * v.z) * (1.0f - c) - (v.x * s)matrix[2][2] = (v.z * v.z) * (1.0f - c) + cmatrix[2][3] = 0matrix[3][0] = 0matrix[3][1] = 0matrix[3][2] = 0matrix[3][3] = 1then you multiply the vertices by this matrix and poof you''ve just rotated an object around an arbitrary axis.There might be an easyer way to do it in opengl but i dont know enough to help you there.hope that helps 0 Share this post Link to post Share on other sites
WhatEver 125 Report post Posted January 28, 2001 Wow, I''ll give it a try in OpenGL. Thank you =DDoes anyone here know how to push this into the OpenGL matrix?Do all matrices get multiplied by each other, even the Transformation matrix?I''m learning . 0 Share this post Link to post Share on other sites
WhatEver 125 Report post Posted January 28, 2001 Nevermind...This seem easy enough void glMultMatrixf( const GLfloat *m ); I''m gonna have some fun with this...oh yeah...bones here I come!!!!! 0 Share this post Link to post Share on other sites