[osg-users] Model(s) load ~10 times longer in 3.6.x than 3.4.x series in osgviewer (and my in-house software)

James Davis davisjamesf at gmail.com
Thu Jul 19 14:49:29 PDT 2018

After changing two files, I have ive files loading very fast AND osgconv converting obj files to osg and ive files very fast.

You'll have to forgive my lack of understanding a lot of the internals of OSG.  The code I changed was due to noticing where bottle necks (for loops) were occurring when loading .ive files in my program.   Once I changed the code and created new libraries, I tested them on the osgconv with speed success.

The code I changed was NOT in the obj plugin but in the osg library itself.  I changed a few lines to previous changes compared to 3.4.1.  Note that I did attempt at trying to use the 3.4.1 obj plugin, but quickly found it was not the problem.

The two files I changed were Geometry.cpp and Drawable.cpp, and I'll need some help understanding why my changes really made a difference.

When I would 'break' in my debugger when loading an ive file, most of the time the process ended up on a for loop in Geometry.cpp (line 582) in the getOrCreateElementBufferObject method.   The callstack was Geometry::read, Geometry::addPrimitiveSet, Geometry::addElementBufferObjectRequired.

I decided to make the change line 28 to #if 1 and add back all the if conditions of _useVertexBufferObjects.   This fixed the load .ive issue but still did not fix the osgconv.   I had to change Drawable.cpp line 229 to #if 1 to make _userVertecBufferObjects = false.

Can someone take a look at the impact _useVertexBufferObjects has on certain files being loaded.  It seems a check needs to be before the for loop of traversing through the drawElementList if it really doesn't need to be called.


Read this topic online here:

More information about the osg-users mailing list