Hi Giulio, On Wed, Sep 22, 2010 at 5:41 PM, Giulio De Vecchi <giulio.devec...@libero.it> wrote: > Hi, > in my application I have a numerical module that create 3d objects and their > meshing (triangulation). What I would like to do is to render these objects > in the fastest possible way. Something like: > - write in a raw array the list of the vertex of the triangles > - tell to OSG to read (and render) that memory area > Is this possible? Where could I find documentation about this? > (I searched in the forum, but I didn't find anything useful).
The OSG has several ways to optimize the rendering of sets of triangles, whether you need to put much processing into this to optimize anything is debatable though - there is a reasonable chance that just passing vertex data and triangles primitives is a relatively unconditioned way will be efficient enough. I simply don't buy you assumption that you need to do it in the "fastest possible way". What I'd recommend is start with the most straight-forward geometry set up can, in you case it's likely to be a single osg::Geometry, with a Vec3Array packed with your vertex data then a DrawArrays or DrawElementsUShort/UInt primitive set to pass how OpenGL should process the vertex data to generate the triangles. See osggeometry and OpenGL documentation on glDrawArrays and glDrawElements to see where this in action. Once you are rendering your mesh benchmark it, if it hits the required performance that you need i.e. your app hits the same frame rate as your screen refresh then your job is done move on. If you don't achieve the required performance then let us know some of the metrics you are working with i..e number vertices, number of triangles, frame rate you need to hit and why, and type of hardware you are targettng. Once we know this we can start introducing various techniques for improving performance. It's pointless pre-emptying this though - you need to go do the basics first. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org