[osg-users] Fast move a lot of nodes to another group

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Tue Apr 18 00:35:50 PDT 2017

Am 4/15/2017 um 6:24 PM schrieb Yura Ivanov:
> Hi,
> I created stateset with bool uniform to indicate that node is selected and mat uniform with current mouse transform. To select nodes, I set this uniforms to nodes and all transformation preforms in shader. On mouse release, all transform applies to nodes by calling setMatrix and mat uniform sets to identity. Everything works fast and after all I don’t have extra nodes and statesets. Maybe my approach in this task is wrong, but many editors, for example 3dsMax, can work with big number of objects. And bad structure of scene in this case is user problem.
> Thank you very much, especially for optimize.

This will disable "native" picking of the nodes however. Also I wonder 
why this should be more efficient than putting every node under a 
transform in the first place.
What you're doing is effectively a poor implementation of instancing. A 
better approach (if you want to use the uniform approach) is to setup a 
uniform buffer object (see [0]) containing the matrices and to use the 
draw-instanced version of your geometry to fetch it based on its 
gl_InstanceId. A version that scales better is to use a texture object 
to hold the matrices (see [1])




> Cheers,
> Yura
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70767#70767
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list