openframeworks / openframeworks/openFrameworks
ofCamera setOrientation gives odd results
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
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?
(note , I am calling resetTranform() on the camera, so it's not an accumulation of rotations.... it's just that I can't seem to find a way to get ofCam to rotate in the same way as opengl commands).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ofCamera, ofNode::setOrientation, ofNode::rotate, and the shown ofQuaternion construction. Compare their rotation behavior with the listed OpenGL transform sequence, including the effect of resetTransform(). Done means identifying whether the discrepancy is an implementation bug or an orientation-semantics difference and documenting or correcting the behavior accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100