Hi

On 10/26/06, Ignacio García < [EMAIL PROTECTED] > wrote:
>          
>  
>  
>
> Hi OSGers,  
>
>    
>
> I have to display a high number (>500) of similar cylinders:  
>
> - Same size (both radius and height)  
>
> - Same texture coordinates (but different texture)  
>
> - Different positions, but fixed (the cylinders don't move)

Looks like a good example of where to share a geometry, i.e. attaching several times the same node to different parents

>
> - Each one has to be a different drawable (or node), so that they can be individually picked, change color or texture.

You can have a single geometry, attached to 500+ geodes. If you don't need to change the geometry data (individual vertices, texture coordinates) you can apply your changes (color, texture, etc ...) to the stateset of the parent geode and you are fine.
But as you need your cylinders to have different positions, you could use MatrixTransforms above the geodes so you could have a single geode with 500+ MatrixTransform parents. Those would contain the statesets, the geode and the geometry would be "stateless".

(mtn being the nth MatrixTransform, ssn being the stateset for the nth MatrixTransform):


         /->  mt1 (ss1) -\
rootnode -->  mt2 (ss2) --> geode -> geometry
         \->  mt3 (ss3) -/


> Which is the most efficient way? Assigning each geometry a unique texcoord array saves opengl calls or just main memory? A MatrixTransform above each node, sharing vertices between geometry or computed vertex positions for each geometry?  
>

Having static objects forces you to have 500 geometries, breaking the I don't know whether it'll speed up much as the matrix multiplications gains will be balanced by a higher load of vertices.
Please keep us informed if you benchmark these possibilities as this is the kind of question that we keep asking ourselves all the time with the OSG :)

Regards

--
Thibault

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to