[osg-users] Questions on optimizing my scene graph
Chris Djali
krizdjali at gmail.com
Mon Sep 2 09:28:45 PDT 2019
Hi,
> Statusswitches are always costly. How does OSG identify if a texture or a program is identical when
> checking for status changes? Is it by comparing the pointers? If yes, it is necessary to manage a pool
> and use the same pointers everywhere?
StateSet::compare takes an optional bool argument that determines whether it compares the contents or just pointers. By default, it's false, so just compares pointers, and the StateSet comparison operators leave it false, and I thinkl they're what actually gets used. That means you should try and use the same StateAttribute instances rather than copies.
You might also find that the priority for choosing which state to sort by doesn't necessarily reflect how expensive a particular change would be on modern GPUs. I don't know if there's a way of changing it, though.
Cheers,
Chris
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76633#76633
More information about the osg-users
mailing list