Hi Koduri, As I said in the previous mail, try to set the osg GL_SURFACE as trasparent. Take a look to osgAndroid (this project was released a week ago by Rafa Gaitán), it has a camera example.
Cheers. 2012/9/3 Koduri Lakshmi <ankiredd...@gmail.com> > Hi Jordi Torres, > > Thank you very much for the help. > > As you suggested I rendered the model with out transform. Model rendered > on screen. > > I am using a 3rd party lib for AR tracking. This lib is configured video > background. This config is for video background. > > Here is the config code > > > Code: > CameraDevice& cameraDevice = QCAR::CameraDevice::getInstance(); > VideoMode videoMode = cameraDevice. > getVideoMode(QCAR::CameraDevice::MODE_DEFAULT); > > VideoBackgroundConfig config; > config.mEnabled = true; //Enables/disables rendering of the video > backgroun > config.mSynchronous = true; //Enables/disables synchronization of > video background and tracking data > /*Relative position of the video background in the render target in > pixels. Describes the offset of the center of video background to the > center of the screen (viewport) in pixels. (0,0) is the center of the > screen*/ > config.mPosition.data[0] = 0.0f; > config.mPosition.data[1] = 0.0f; > /*Width and height of the video background in pixels. */ > config.mSize.data[0] = screenWidth; > config.mSize.data[1] = videoMode.mHeight > * (screenWidth / (float)videoMode.mWidth); > //for correct aspect ratio > > > > Renderer::getInstance().setVideoBackgroundConfig(config); > > > > After config video background I am rendering video background with the > following statement > > > Code: > Renderer::getInstance().drawVideoBackground(); > > > > > Even with the transformation matrix the model is rendering correctly with > out this statement. When I added this statement the model disappears on the > screen. > > I tried to set Viewport and projection matrix to the viewers camera. But > still I not able to see the 3D model on screen. > > > This is the code for OSG INIT > > > Code: > if(mload) > { > > LOG("Init=============="); > int x=0; > int y=0; > > int width=screenWidth; > int height=screenHeight; > > _viewer = new osgViewer::Viewer(); > _viewer->setUpViewerAsEmbeddedInWindow(x, y, width, height); > _root = new osg::Group(); > > _viewer->realize(); > _state = _root->getOrCreateStateSet(); > _state->setMode(GL_LIGHTING, osg::StateAttribute::ON); > _state->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON); > _state->setMode(GL_CULL_FACE, osg::StateAttribute::ON); > > _viewer->setSceneData(_root.get()); > > _viewer->addEventHandler(new osgViewer::StatsHandler); > _viewer->addEventHandler(new > osgGA::StateSetManipulator(_viewer->getCamera()->getOrCreateStateSet())); > _viewer->addEventHandler(new osgViewer::ThreadingHandler); > _viewer->addEventHandler(new osgViewer::LODScaleHandler); > > _manipulator = new osgGA::KeySwitchMatrixManipulator; > > _manipulator->addMatrixManipulator( '1', "Trackball", new > osgGA::TrackballManipulator() ); > _manipulator->addMatrixManipulator( '2', "Flight", new > osgGA::FlightManipulator() ); > _manipulator->addMatrixManipulator( '3', "Drive", new > osgGA::DriveManipulator() ); > _manipulator->addMatrixManipulator( '4', "Terrain", new > osgGA::TerrainManipulator() ); > _manipulator->addMatrixManipulator( '5', "Orbit", new > osgGA::OrbitManipulator() ); > _manipulator->addMatrixManipulator( '6', "FirstPerson", new > osgGA::FirstPersonManipulator() ); > _manipulator->addMatrixManipulator( '7', "Spherical", new > osgGA::SphericalManipulator() ); > > _viewer->setCameraManipulator( _manipulator.get() ); > > _viewer->getViewerStats()->collectStats("scene", true); > > > _viewer->getCamera()->setViewport(0,0,width, height); > > > _viewer->getCamera()->setProjectionMatrix(osg::Matrix(projectionMatrix.data)); > > > > trans=new osg::MatrixTransform(); > > > LOG("Load Model"); > osg::ref_ptr<osg::Node> loadedModel = > osgDB::readNodeFile("/mnt/sdcard/OSG/lz.osg"); > if (loadedModel == 0) { > LOG("Model not loaded"); > } else { > LOG("Model loaded"); > > > loadedModel->setName("/mnt/sdcard/OSG/lz.osg"); > //_root->addChild(loadedModel); > trans->addChild(loadedModel.get()); > } > > _root->addChild(trans.get()); > > _viewer->setSceneData(NULL); > _viewer->setSceneData(_root.get()); > _manipulator->getNode(); > _viewer->home(); > > _viewer->getDatabasePager()->clear(); > _viewer->getDatabasePager()->registerPagedLODs(_root.get()); > _viewer->getDatabasePager()->setUpThreads(3, 1); > _viewer->getDatabasePager()->setTargetMaximumNumberOfPageLOD(2); > _viewer->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true, > true); > mload=false; > } > > //_viewer->frame(); [b]If I enabled only this by commenting the following > then the model renders correctly.[/b] > > > State state = Renderer::getInstance().begin(); > // Explicitly render the Video Background > Renderer::getInstance().drawVideoBackground(); // > > for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++) > { > // Get the trackable: > const Trackable* trackable = state.getActiveTrackable(tIdx); > Matrix44F modelViewMatrix = > Tool::convertPose2GLMatrix(trackable->getPose()); > > > _viewer->frame(); > > QCAR::Renderer::getInstance().end(); > > break; > } > > > > > > > > AR lib code to get the projection matrix > > > Code: > CameraCalibration& cameraCalibration = > CameraDevice::getInstance().getCameraCalibration(); > projectionMatrix = Tool::getProjectionGL(cameraCalibration, 2.0f, > 2000.0f); //Returns an OpenGL > style projection matrix > > > > Do I need to add any thing to the viewers settings. > > Can you please help me where am I doing the mistake. > > > > ... > > Thank you! > > Cheers, > Koduri > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=49724#49724 > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Jordi Torres Fabra gvSIG 3D blog http://gvsig3d.blogspot.com Instituto de Automática e Informática Industrial http://www.ai2.upv.es
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org