I’m developing an augmented reality framework for educational purposes. I have created all needed method excepting the module that shows 3D objects.
By now my intention is show a cube, but I’m having a lot of problem with the geometric consistency. It seems an easy task at first, but I’ve spent a month of my time trying stuffs and reading documentation.
This is the issue:
A camera is calculated from point correspondences. In this case the structure of the camera is K[R | r] (a typical nomenclature in computer vision).
K = A transformation which contains the focal length
R = A rotation matrix, encoding the camera orientation
t = A translation vector, encoding the position of the camera
Furthermore, in computer vision it’s typical to consider the origin at the top-left corner of the image, but in OpenGL the origen is at the left-down corner.
I have tried to put the focal length into the Projection matrix using gluPerspective and the equivalent fovy. In the Modelview matrix I’ve loaded the [R|t] matrix (I loaded both by columns).
To ensure that my original camera is right I’m drawing a cube using ortho2D projection and the original camera. The result is right.
In short, when I draw objects using the ortho projection and the original matrix all works fine. When I “break” the original matrix and then I put each piece in a OpenGL matrix the result is wrong.
Could somebody help me?