openframeworks/openFrameworks — Issue #785: ofCamera setOrientation gives odd results
Author: ofZach
Created: 2011-10-19 11:16:42+00:00
State: open

I am loading in boujou camera data (translation and euler rotation), and I get really fine results when I do:

glTranslatef(tx,ty,tz);
glRotatef(rx, 1,0,0);
glRotatef(ry, 0,1,0);
glRotatef(rz, 0,0,1);

but when I create an ofCamera, and do:

setPosition(ofPoint(tx, ty, tz));
setOrientation(ofPoint(rx, ry, rz));

I get strange results. I am wondering about ofNodes "setOrientation" and if it's really right in that the order is switched:

setOrientation(ofQuaternion(eulerAngles.y, ofVec3f(0, 1, 0), eulerAngles.x, ofVec3f(1, 0, 0), eulerAngles.z, ofVec3f(0, 0, 1)));

also, maybe I am mis interpreting what "set orientation" does. But I can't seem to get similar results with ofCam, even if I do, for example,

cam.setPosition( tx,ty,tz);
cam.rotate( rx, 1,0,0);
cam.rotate( ry, 0,1,0);
cam.rotate( rz, 0,0,1);

I still don't get the same results as when I do it via opengl. This seems like a bug maybe with how ofNode handles rotation?