converting coords for gluLookat() - SOLVED

hi all

i want to use the face tracking to have a camera pos and angle move through a 3D scene. this almost works but the camera position is offset from center. I think this is because open gl uses a different coordinate system than OF, but i’m not sure how to do the conversions. i think a page on this could be a valuable addition to the wiki, happy to put that together if someone can help me get my head around it.

so i have an x,y,z coords that i want to move the camera around with, while keeping the lookat point centered:

		gluLookAt( -translate_x,  

i think i need to convert the width and height to percentages and adjust the origin but if someone could point out how to do this that would be great.


Try to have a look at the addon rui have started:…-ofx3dutils … It has some nice functions for moving the camera around, so you don’t have to think about the coordinate problem (or you could have a look in the code how we do it there)

*apologies to anyone who read this post before this edit

thanks heaps for the addon, works a treat

just had to add this to testApp.h to compile:

float mx, my;