Wrong 3D coordinate when using ofEasyCam?

Just noticed weird behaviour of ofEasyCam.
I understand oF is using Left-handed coordinate system for 3D as same with OpenGL.
However when I use ofEasyCam, it seems working with Right-handed.

Test code here,

ofEasyCam cam;
bool useCam;

void ofApp::draw(){
        ofTranslate(ofGetWidth()/2-50, ofGetHeight()/2-50);
    ofSetColor(200, 0, 100);
    ofTranslate(0, 0, (ofGetFrameNum()*5)%600);
    ofDrawBox(0,0, 10, 10);

void ofApp::keyPressed(int key){
    useCam = !useCam;

and screenshots

default coordinate, Left-handed

ofEasyCam, Right-handed

Tested on OSX, oF latest master

I noticed ofSetCoordHandedness(OF_LEFT_HANDED); method but it does not change situation.

Hi, I’d rather say that this is because the cameras have the y axis flipped. So, when you draw without a camera the Y axis starts at the top of the screen and it increases as it goes down the screen.
With a camera you get the Y axis flipped so, positive Y axis values go up in the screen.

You can switch this by calling cam.setVFlip(false);

let me know if this fixed the issue.


Thank you Roy,

True that cam.setVFlip(true) makes ofEasycam left-handed.
But feeling strange that oF default and ofEasyCam having a different 3D coordinate system. :thinking:

The default OF view is thought to be used mainly with 2D where y growing downwards makes more sense because of how the mouse coordinates or image coordinates work.

in 3D though, when using a camera, having y growing upwards is more standard that’s why ofCamera defaults to that.

we could have flipped z in any of them to have the same handedness in both by i imagine it would have been even more confusing

1 Like