How to change right-handed coordinate to left-handed?


#1

I’m designing a visulizer for my offline renderer, but I use left-handed coordinate in it.

At first I find a function named setCoordHandedness(). But the renderer didn’t implement it.

ofSetCoordHandedness(OF_LEFT_HANDED);

Then I tried to set the camera’s vFlip, but the result seems weird.

cam.setFVlip(true);

Is there a common way to change right-handed coordinate to left-handed,to use a user-defined vertex shader maybe?


#2

1.Load a user-defined vertex shader to replace the default one(but failed in output both texture color and globalColor)

2.Create my own camera object to overturn the x axis.(override some ofNode’s function, but not concision at all)

3.After read the Mitsuba’s handedness convention, I tried to multiply a matrix, and it worked well.

cam.begin();
// actually you can swap any three axis of them
ofMatrix4x4 m(-1, 0, 0, 0,
               0, 1, 0, 0,
               0, 0, 1, 0,
               0, 0, 0, 1);
ofMultMatrix(m);

// draw someting
// already turned to left-handed coordinate

cam.end();