Hi. I'm trying to port an OpenGL augmented reality program based on the ArUco library (http://www.uco.es/investiga/grupos/ava/node/26) to OSG (I'm not trying OSGArToolkit yet). The original OpenGL program shows a perfect overlap between the AR marker and the geometric model. The OSG version doesn't.
Here's the code outline. Differences between versions are marked with "-->". OPENGL PROGRAM ============== 1) Projecton matrix initialization: double projection_array[16]; ar::getProjectionMatrix(opencv camera parameters, projection_array); -->glMatrixMode(GL_PROJECTION); -->glLoadMatrix(projection_array); 2) Main loop: cameraCapture(frame); // frame is unsigned char *. double modelview_array[16]; ar::getMarkerModelViewMatrix(frame, modelview_array); -->glMatrixMode(GL_MODELVIEW); -->glLoadMatrix(modelview_array); ...draw stuff OSG PROGRAM =========== 0) OSG misc initialization: // Prevent the default (trackball) manipulator from overwriting the modelView matrix continuously. // http://forum.openscenegraph.org/viewtopic.php?p=44126#44126 -->osg::Camera *cam = viewer.getCamera(); -->cam->setAllowEventFocus(false); 1) Projection matrix initialization: double projection_array[16]; ar::getProjectionMatrix(opencv camera parameters, projection_array); -->osg::Matrixd projectionMatrix; -->projectionMatrix.set(projection_array); -->viewer.getCamera()->setProjectionMatrix(projectionMatrix); 2) Main loop: cameraCapture(frame); double modelview_array[16]; ar::getMarkerModelViewMatrix(frame, modelview_array); -->osg::Matrixd modelViewMatrix; -->modelViewMatrix.set(modelview_array); -->viewer.getCamera()->setViewMatrix(modelViewMatrix); ... draw stuff (with NodeCallbacks). What could be wrong? Thanks, Juan Herrera _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org