Archived

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

ZubZorro

rotations and translations... use the built-in functions?

Recommended Posts

Hi. I''ve been wondering about this for quite some time. Should one use the built-in functions to do ones rotations/translations? i use opengl, so, When i look in the red-book, it tells me to do it instead of calculating my own, even in the performance section. But i want to do skeletal animation, and when i do that, it seems like it would be much smarter and easier to do it by myself... well actually i cant figure out how to do it with the built-in functions... And what if I use Quaternions to interpolate, isnt it a bit ackward to create a matrix from the quaternion, then loading it, and entering the matrix, instead of just multiplying the matrix to the vertex myself? Hope someone will help me figure this out Jonas

Share this post


Link to post
Share on other sites
The primary advantage of using the built-in functions is hardware acceleration - the graphics hardware does for you what the CPU would otherwise do. However, you might find a good reason to do it yourself, especially if you''re attempting nonstandard transforms. The best bet would be to find a way to have the hardware do your own trnasforms. Keep in mind that many games feature skeletal animation these days, and virtually all of them do it using the DirectX and OpenGL APIs.

As always, these statements reflect my opinion. You may fire when ready.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Not sure about this, someone tell me if this is wrong, but if you want OpenGL to do the transforms for you, you could probably use the matrix stack, place a new matrix on the stack, glLoadMatrix() your matrix into gl, do your multiplication, whatever, and then extract the matrix from the matrix stack (glGet(GL_MODELVIEW_MATRIX)...not sure tho). Then you''d have the end matrix as though you''ve done it yourself. Then use the end matrix to do your skeletal animation, whatever. However, this might have limitations...not sure.

Share this post


Link to post
Share on other sites
There''s no universal answer to this: what''s best depends on a number of factors, inclduding on the one hand the quality of the libs, whether thay take advantage of hardware acceleration etc., and on the other hand your own programming/optimising skills and how well the compiler will optimise your code.

The easiest way to find out what is best is try it both ways. Then run a few performance tests and/or examine the assembly generated to see which is faster. You may well find that either way is more than fast enough on a modern fast processor, and so time spent optimising might be better spend elsewhere.

Share this post


Link to post
Share on other sites
okay Seeing that people seem kindof neutral to the subject, i will rephrase my Question.

Is it possible to do it with gl''s push-matrix and pop-matrix?

it seems not to me, because, one has to draw triangles consisting of vertexes from different bones.

this means that they have different transformations.
here it follows that i must do a transform inside glBegin...
bad!

or at least thats how i get it...
so i really cant seem to figure how to handle it with the builtin gl-functions?

jonas

Share this post


Link to post
Share on other sites