Andy Skinner wrote on Tuesday, May 22, 2007 3:01 PM:
> Thanks for the suggestion.  I've been trying things and looking at OSG
> code and have some more questions.
> 
> When I actually looked at the sortByState() method in RenderBin, it
> says that it doesn't do anything, because state sorting is more
> expensive than it is worth.  It also says: "The contents of the
> StateGraph leaves is already coarse grained sorted, this sorting is
> as a function of the cull traversal."
> 
> What does this mean?  My guess is that it refers to putting things
> into RenderBins (using setRenderingHint() and any explicit render
> bins I set).  Can anything else set stuff into render bins, or any
> other kinds of sorting?
> 
> I did implement a NoSortRenderBin, but I'm not sure it does anything
> different than the standard RenderBin calling sortByState().
> 
> If I don't change the sort mode (I think default is sort by state?),
> don't call setRenderingHint() (so only one pass) and turn off depth
> tests and writes, will I draw in order of a depth-first traveral of
> the tree?  Or is there sorting or grouping somewhere else?

osgUtil::CullVisitor groups Drawables according to their StateSet. If
none of your Drawables share a StateSet (it only compares StateSet
pointers because actual comparison is too expensive), then what you
suggest should result in depth-first traversal of the tree.

Of course, not sharing StateSets is kind of expensive in space and time
(since you end up with many more OpenGL state changes); the only
alternative I can see is writing your own CullVisitor instead of using
osgUtil::CullVisitor if you really need depth-first drawing order.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz
> Sent: Friday, May 18, 2007 4:20 PM
> To: 'osg users'
> Subject: RE: [osg-users] controlling ordering
> 
>> Sometimes we might want to control the ordering of how things
>> are actually drawn.  We have cases where we'd like things to
>> come out in the order in which they appear in a depth-first
>> traversal of the scene graph, with no zbuffer.  (Obviously,
>> this is a special case, usually just 2D.)
>> 
>> We can turn off the zbuffer, but how would we get OSG to not
>> sort into bins or re-order in any other way?
>> 
>> We have a SceneView and call cull and draw on it.
> 
> Well, the OSG way is to put things in a RenderBin. So, you could
> create your
> own custom RenderBin and then override the methods that handle sorting
> so
> that the sort is a no-op. Then change the StateSet that your scene
> graph uses so that the CullVisitor places everything in this new
> custom RenderBin.
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/



-- 
Bryan Thrall
FlightSafety International
[EMAIL PROTECTED]
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to