PDA

View Full Version : Using OpenGL just for transformations



zoldar256
08-15-2001, 01:39 PM
Would it be advantages to use OpenGL for matrix transformations and other mathmatical transforms instead of my own C functions for the same? Or would calling gluProject a whole mess of times (> 1000) be just too much overhead?
I know (At least on my mac) OpenGl takes advantage of Altivec (And probably other vector processing units on other chips), so I'd imagine I could get a performance boast from OpenGL's optimizations. But I don't know.... What do you think?

mikael_aronsson
08-15-2001, 10:12 PM
Hi !

gluProject is pretty slow so I don't think you would have much use for it.

Mikael

Bob
08-16-2001, 03:32 AM
Don't use OpenGL as a math library. Even though OpenGL might use optimized code, it's not just the actual calculation that takes time. You must send the vectors/matrices to OpenGL, OpenGL must calculate the result, and then give it back to you. This last step is what usually takes time. Over all, this is (very) slow.

If the driver can use special instructions, there is (or atleast should be) no reason you can't.

DFrey
08-16-2001, 03:33 AM
This has been stressed many times before on the board. You should not use OpenGL as a math library. Your own math routines should be much faster. If you want to take advantage of Altivec you should learn to take advantage of it yourself, or find a math library that does (I'd think such a library exists and is likely available from the chip maker).

<edit>
I have since looked and discovered that Motorola does not actively support Altivec by providing a math library, but they do provide a link to an Altivec web ring. Surely some Altivec tools are available within that ring.


[This message has been edited by DFrey (edited 08-16-2001).]