A - Matrix operation are not harware accelerated
So doing
glMatrixLoadIdentity();
glRotatef(30.f, 1.f, 0.f, 0.f);
glTranslate(0.f, 1.f, 1.f);
DrawObject();
is the same than:
myMatrixLibrary::Matrix4 modelView(myMatrixLibrary::Identity4);
modelView.rotate(30.f, eXAxis);
modelView.translate(0.f, 1.f, 1.f);
glLoadMatrixf(modelView.getPtr());
DrawObject();
probably the code of the driver that perform matrix operation is untouched by twenty years.
You also have the advantage that you have the matrix wherever you want, you don’t need to ask openGL the current matrix.
If you don’t draw anything is useless to use openGl only for matrix operation.
B- using glGet is a performance killer.
Driver is the interface between software and hardware. Every time you send an openGl command this should be sent to the GPU. But to interact with the hardware the driver must go in protected mode… software interrupt, context switch, cache flush… ARGH… a lot of wasted time.
To avoid of doing a context switch for every openGl command the driver put the command in a queue, when the queue is full it perform a context switch, probably once per frame. If you use a glGet you are asking the state of some value, so the driver must evaluate all the command in the queue and trigger a context switch. Doing many glGet can slow down your application a lot.
So, DON’T EVER USE glGetFloat if you care about performance.
If you want to rotate around and arbitrary axis you can simply go here
http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/
or study quaternion, and implement your own matrix library.
Otherwise, if you are lazy you can go on Google and look for a free linear algebra library (better if sse2 accelerated).
http://software.intel.com/en-us/articles…2-instructions/