Hi Robert, thank you for your reply. I appreciate your help :)
I'm sorry if I didn't express myself correctly. I also have to admit I'm not quite the expert on computer graphics. Let's try to make it clearer. I want to know which of the lines on my model are visible in a rendered image. That would be the case if a line results in at least one drawn pixel. I need to have this information for an AR application which performs edge tracking. Such approaches work with 2D-3D correspondences for each frame to estimate the camera parameters. The recorded webcam image of an object shows of course only the edges of the object which are visible from the cameras point of view. To get the correspondences I need excactly the same lines on the model (from the last frame). I programmed a working OPENGL example for finding out the visible lines using occlusion query glGetOcclusionQueryuivNV. At the moment I fail to understand how to make that work for OSG. I had a look at osgocclusionquery and the used OcclusionQueryNode and understand that it uses ARB_occlusion_query to check the pixel count. I tried the following but the output of the visible lines is still incorrect: Code: osg::Node* scene = osgDB::readNodeFile("file.dae"); if (!scene) return 1; osg::Group* rootnode = new osg::Group; rootnode->addChild(scene); viewer.setSceneData(rootnode); GetLinesVisitor lineFinder; scene->accept(lineFinder); lines = lineFinder.getLineVector(); for(int i = 0; i < lines.size(); i++){ osg::ref_ptr<osg::OcclusionQueryNode> parent = new osg::OcclusionQueryNode; parent->setVisibilityThreshold( 0 ); osg::Geometry* linesGeom = new osg::Geometry(); osg::Vec3Array* vertices = new osg::Vec3Array; vertices->push_back(lines.at(i).start); vertices->push_back(lines.at(i).end); linesGeom->setVertexArray(vertices); linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,2)); osg::Geode* geode = new osg::Geode(); geode->addDrawable(linesGeom); parent->addChild(geode); //A std::vector for all OcclusionQueryNodes. I later ask in a loop for each element oqNodes.at(i).get()->getPassed() and count the trues oqNodes.push_back(parent); rootnode->addChild(parent); } So here are my questions: (1) How do I set up an OcclusionQueryNode for each line? (2) Why does the approach from my previous post not work? Is the calculation of screen coordinates (using MVPW matrix) for a given vertex really so imprecise that I cannot count on this being the correct coordinates to look up in the depth buffer? Cheers, Dakota ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51538#51538 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org