Re: [osg-users] [osgPPU] multiple processors

2012-12-05 Thread Daniel Schmid
I'm kind of talking to myself here... and since 2010 there is no sign of Art 
Tevs... anybody saw him lately?

Well, if anybody cares, I found out a solution to have multiple processors with 
compositeviewer, each view can have its different osgPPU pipeline, etc.

1. All you need to add is a group node to your scene, that holds all the 
processors. 
2. then you need to add this little snippet of code to Processor.cpp in the 
traverse method:


Code:

void Processor::traverse(osg::NodeVisitor nv)
{
if (!mCamera)
return;

// if not initialized before, then do it
if (mbDirty) init();

// if subgraph is dirty, then we have to resetup it
// we do this on the first visitor which runs over the pipeline because 
this also removes cycles
if (mbDirtyUnitGraph)
{
mbDirtyUnitGraph = false;

// first resolve all cycles in the set
ResolveUnitsCyclesVisitor rv;
rv.run(this);

// mark every unit as dirty, so that they get updated on the next call
MarkUnitsDirtyVisitor nv;
nv.run(this);

// debug information
osg::notify(osg::INFO)  
  
std::endl;
osg::notify(osg::INFO)  BEGIN   getName()  std::endl;

SetupUnitRenderingVisitor sv(this);
sv.run(this);

osg::notify(osg::INFO)  END   getName()  std::endl;
osg::notify(osg::INFO)  
  
std::endl;

// optimize subgraph
OptimizeUnitsVisitor ov;
ov.run(this);
}

[b]// make sure we render only our own camera
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
{
  osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor *(nv);
  if (cv)
  {
if (cv-getCurrentCamera() != getCamera())
{
  return;
}
  }
}
[/b]
// first we need to clear traversion bit of every unit
if (nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
{
CleanUpdateTraversedVisitor::sVisitor-run(this);
}

// if processor is propagated by a cull visitor, hence first clean the 
traverse bit
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
{
osg::notify(osg::DEBUG_INFO)  
  
std::endl;
osg::notify(osg::DEBUG_INFO)  BEGIN FRAME   getName()  
std::endl;

CleanCullTraversedVisitor::sVisitor-run(this);
}

if (mbDirtyUnitGraph == false || nv.getVisitorType() == 
osg::NodeVisitor::NODE_VISITOR)
{
osg::Group::traverse(nv);
}

// check if we have units that want to be executed last, then do so
if (mbDirtyUnitGraph == false  nv.getVisitorType() == 
osg::NodeVisitor::CULL_VISITOR)
{
for (std::listUnit*::iterator it = mLastUnits.begin(); it != 
mLastUnits.end(); it++)
{
placeUnitAsLast(*it, false);
(*it)-accept(nv);
placeUnitAsLast(*it, true);
}
mLastUnits.clear();
}
}




3. You need to make sure your camera viewport of each view is set to an origin 
of 0/0. Control the position of the rendering viewport by setting the UnitOut 
viewport to the desired origin. 

This is due to a limitation of osgPPU, which copies to and from the render 
target always relative to a 0/0 origin.


Now Enjoy osgPPU and compositeViewer!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51363#51363





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] multiple processors

2012-12-05 Thread Art Tevs
Hi,

Art is here, he was always here :)

My current research and work is non-osg related, hence I unfortunately somehow 
stalled in producing updated. 

Daniel, could you post the code as a patch to the osgPPU version you use? I 
would then implement this into the code.


Cheers,
Art

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51367#51367





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [osgPPU] multiple processors

2012-11-20 Thread Daniel Schmid
Hi art and all

This is not my first post about osgPPU and composite viewer, but I get no read 
feedback so I try it once more.

I have a composite viewer, and I can add views at runtime. I use osgPPU and it 
works with one viewer (the first created). For every additional viewer I also 
create a separate unit pipeline and separate processor, and I add the latter to 
the scene graph root node.

Everything seems to work, except that osgPPU runs only on the first view, every 
additional viewer is black. 

Art, can you provide some feedback where the drawbacks are that hinder my 
second view of having his own postprocessing? I have a separate processor, 
separate units and the processor attached to the correct camera. What else do I 
have to check?


Thank you!

Cheers,
Daniel

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51169#51169





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org