[osg-users] Huge perfomance issues

Achilleas Margaritis axilmar at gmail.com
Thu May 30 03:53:20 PDT 2019


I am developing a data visualization application with Qt + OSG, but I have huge performance problems.

These problems are not due to OSG itself but rather due to how I use OSG (I just started using OSG/OpenGL for the first time).

The application accepts a lot of data as messages over the network, and draws polygons and lines according to the received data.

In order to make drawing easy, I have developed a class which has many drawing functions: DrawPolygon, DrawPolygonLine, DrawLine, DrawRectangle. DrawCircle, DrawCube, etc.

In every of these functions, I do the following:

1) create a Geode.
2) create a Geometry and attach it to the Geode created above.
3) create a material with the appropriate colors for the drawing, attached to the Geode created above.
4) create a state set for the drawing properties, attached to the Geode created above.

At each frame, I delete all the objects created, and then use the API I described above (i.e. DrawPolygon, DrawPolygonLine etc) to recreate the drawings with the newly received data.

The frame rate is abysmal though. After the creation of a few tens of polygons and lines (around 100), the frame rate drops extremely low and the UI becomes totally unresponsive.

The code I have created is largely copied from the OSG examples I have found online, mostly from the osggeometry.cpp example.

My question is what am I doing wrong?

Is the multiple statesets created the problem? Each Drawing function creates a new stateset, a new vertex array, a new primitives array, a new geode etc.

Thank you!


Read this topic online here:

More information about the osg-users mailing list