Re: [osg-users] Visibility of lines
Hi, I think there might be a small bug in osg::OcclusionQueryNode, that I've yet to find. Here is a small example with a line triangle, that shows the problem. I added no face geometry so the lines should basically always be visible when in view. Each line is under an OcclusionQueryNode, but under some camera poses using the trackball manipulator, line 3 isn't visible, although it should be. When I put all the lines in a osg::Group, they are visible. Does anybody have an idea where the problem might be? Code: #include osg/Group #include osgViewer/Viewer #include osgViewer/ViewerEventHandlers #include osgGA/TrackballManipulator #include osg/OcclusionQueryNode #include vector int main( int argc, char** argv ) { int width = 640; int height = 480; osgViewer::Viewer viewer; osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setClearColor(osg::Vec4(1.0, 1.0, 1.0, 0.0)); camera-setViewport( new osg::Viewport(0, 0, width, height) ); camera-setProjectionMatrixAsPerspective(30.0f, static_castdouble(width)/static_castdouble(height), 1.0f, 1.0f ); viewer.setCamera(camera); osg::Group* rootnode = new osg::Group; viewer.setSceneData(rootnode); viewer.addEventHandler(new osgViewer::StatsHandler); viewer.setUpViewInWindow(200, 200, width, height); viewer.setCameraManipulator( new osgGA::TrackballManipulator ); std::vectorosg::Vec3 lines; //Line 1 lines.push_back(osg::Vec3(-1,0,0)); lines.push_back(osg::Vec3(0,1,0)); //Line 2 lines.push_back(osg::Vec3(0,1,0)); lines.push_back(osg::Vec3(1,0,0)); //Line 3 lines.push_back(osg::Vec3(1,0,0)); lines.push_back( osg::Vec3(-1,0,0)); for(int i = 0; i 3; i++){ //osg::ref_ptrosg::Group parent = new osg::Group; osg::ref_ptrosg::OcclusionQueryNode parent = new osg::OcclusionQueryNode; parent-setVisibilityThreshold(1); parent-setQueriesEnabled(true); osg::Geometry* linesGeom = new osg::Geometry(); osg::Vec3Array* vertices = new osg::Vec3Array; vertices-push_back(lines.at(i+i)); vertices-push_back(lines.at(i+i+1)); osg::Vec4Array* color = new osg::Vec4Array; color-push_back(osg::Vec4(1,0,0,1)); linesGeom-setColorArray(color); linesGeom-setColorBinding(osg::Geometry::BIND_OVERALL); 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); rootnode-addChild(parent); } return viewer.run(); } Cheers, Dakota -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51621#51621 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] osgdem: set texture minfilter and magfilter to nearest?
I took the coward's way out before and manually changed the min and mag filter settings in the VPB src to accomplish this task. This worked in a pinch but I'd like to get back on the VPB trunk and learn how to do this the right way. Any advise on how to search an entire PagedLOD terrain complex with many levels in order to change the min and mag filters for the textures? I've been converting .ive files to .osg to inspect their structure and see that what I need to do is to visit every osgTerrain::ImageLayer within each ColorLayer of each TerrainTile within the entire terrain complex and then set each of the ImageLayer's MinFilter and MagFilter to my desired setting of NEAREST. I tried creating a NodeVisitor to accomplish this task but realized that it would only traverse the top level of the terrain and would not visit the child .ive files (I think this is because of the PagedLOD structure). I looked for how to traverse a PagedLOD and found this thread: http://forum.openscenegraph.org/viewtopic.php?t=5146 but before I go too far in any one direction I figured I'd ask here to see if somebody can point me in the right direction. As always, my sincere thank you. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51622#51622 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] osgdem: set texture minfilter and magfilter to nearest?
It looks like what I might need is the code from the fourth post on this page: http://forum.openscenegraph.org/viewtopic.php?t=2130 My current NodeVisitor is very similar to this, I just wasn't familiar with using the osgDB::Registry::instance()-readNodeImplementation() part of the code and have only ever used the osgDB::readNodeFile method. I'll see if I can get this working, though I don't yet understand why this Registry readNodeImplementation part is necessary... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51623#51623 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Drawable init method?
Ok, that was exactly what i needed. Thanks a lot! Cheers, Alex -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51624#51624 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Change Camera FBO attachment
Hi All, in my application I need an FBO camera to render different frames into different textures, because they will be used by an encoder and thus need to persist for some time. I haven't found an easy way to copy the contents of a texture or of an FBO into another texture. So during the update traversal I change the camera texture attachment with a new texture and call Renderer::SetCameraRequiresSetUp(true). Eveything works fine, but I'm wondering if there's a better/cleaner approach to achieve the same result, as I don't know whether requesting the camera setup every frame has a huge impact on perfomances. Thank you, Ricky ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Change Camera FBO attachment
Hi Riccardo, Setting up the camera's rendering backend on each frame will be expensive. Personally I'd just using multiple RTT Camera each with their own FBO and Textures associated with them. Using a Switch, Sequence or NodeMask's you can select which of the Camera you want to render to on each frame. Robert. On 18 December 2012 17:24, Riccardo Corsi riccardo.co...@kairos3d.itwrote: Hi All, in my application I need an FBO camera to render different frames into different textures, because they will be used by an encoder and thus need to persist for some time. I haven't found an easy way to copy the contents of a texture or of an FBO into another texture. So during the update traversal I change the camera texture attachment with a new texture and call Renderer::SetCameraRequiresSetUp(true). Eveything works fine, but I'm wondering if there's a better/cleaner approach to achieve the same result, as I don't know whether requesting the camera setup every frame has a huge impact on perfomances. Thank you, Ricky ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgPPU] Objects not released
Hi all I'm trying to track down some memory leaks in my application which uses osgPPU. I noticed a difference between the following two methods of cascading units: - When I cascade units through childUnit-setInputToUniform(parentUnit, ...), then the units seem to have a object reference that is not correctly unref'd, therefore unit is not released. - When I cascade units through the parentUnit-addChild(childUnit) method, and add the texture uniforms in the ShaderAttribute, then everything works correctly. I decided to use the second solution, although I find the first one nicer... Anybody else observered memory leaks? Thank you! Cheers, Daniel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=51627#51627 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org