OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Huge perfomance issues


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
axilmar
Newbie


Joined: 30 May 2019
Posts: 4

PostPosted: Thu May 30, 2019 10:53 am    Post subject:
Huge perfomance issues
Reply with quote

Hi,

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!

Cheers,
Achilleas
Back to top
View user's profile Send private message
Werner Modenbach
Guest





PostPosted: Fri May 31, 2019 3:12 pm    Post subject:
Huge perfomance issues
Reply with quote

Hi Achilleas,

your explanations look to me like "I want to repaint my living room. So I destroy my house and ..."
My suggestion:
For each kind of geometry create it as geode and add it to a switch node. So you can switch them on and off as needed.
For alterations keep pointers to the geodes and alter the geometries. I.e. assign new coordinate arrays etc. .
Also there is no need to do it within a frame.

Regards

- Werner -


Am 30.05.2019 um 12:53 schrieb Achilleas Margaritis:
Quote:
Hi,

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!

Cheers,
Achilleas

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76154#76154








------------------
Post generated by Mail2Forum
Back to top
axilmar
Newbie


Joined: 30 May 2019
Posts: 4

PostPosted: Fri May 31, 2019 3:34 pm    Post subject:
Re: Huge perfomance issues
Reply with quote

The problem is I need to destroy my house every frame.

There is no standard number of objects received; any object, with any configuration, can be received at any time.

My only choice is to destroy everything and repaint everything.
Back to top
View user's profile Send private message
Alberto Luaces
Guest





PostPosted: Fri May 31, 2019 3:40 pm    Post subject:
Huge perfomance issues
Reply with quote

"Achilleas Margaritis" writes:

Quote:
The problem is I need to destroy my house every frame.

There is no standard number of objects received; any object, with any configuration, can be received at any time.

My only choice is to destroy everything and repaint everything.

You can also modify the primitives and statesets instead of creating/destroying.

--
Alberto



------------------
Post generated by Mail2Forum
Back to top
Werner Modenbach
Guest





PostPosted: Fri May 31, 2019 3:41 pm    Post subject:
Huge perfomance issues
Reply with quote

There should be a better approach.

Just a quick idea:

For each kind of object keep an array of pointers to already created geodes.
If you don't need a certain geode switch it off in the osg::Switch.
If you get a request for a new one, check the switch for inactive geodes. If found, just alter it and activate it.
Otherwise append a new one.

In some way you need an organization for the objects.

Am 31.05.2019 um 17:34 schrieb Achilleas Margaritis:
Quote:
The problem is I need to destroy my house every frame.

There is no standard number of objects received; any object, with any configuration, can be received at any time.

My only choice is to destroy everything and repaint everything.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76162#76162










------------------
Post generated by Mail2Forum
Back to top
axilmar
Newbie


Joined: 30 May 2019
Posts: 4

PostPosted: Fri May 31, 2019 3:52 pm    Post subject:
Re: Huge perfomance issues
Reply with quote

So, in other words, keep objects preallocated and switch on only the necessary ones?

And if there is no current object that matches the existing ones, then and only then create a new one?

Not a bad idea, in fact.

Thanks a lot for the reply.
Back to top
View user's profile Send private message
GarfieldPig
Appreciator


Joined: 26 Oct 2018
Posts: 129

PostPosted: Sat Jun 01, 2019 3:29 am    Post subject:
Use VAO and VBO
Reply with quote

Hi,
By the way,the default vertex specification of geometry is displaylist,if you need to change vertex frequently,use VAO and VBO.

Thank you!

Cheers,
Yu
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Sun Jun 02, 2019 8:35 pm    Post subject:
Huge perfomance issues
Reply with quote

I think I'd create a single object to represent ALL of the objects of a given class, eg Lines, PolygonLines, Rectangles, etc. Set this up to use buffer objects and it will refer to the buffer object to fetch the vertices, indices, and possibly attributes for the appearance.

Then on each frame after you have received ALL the data, bulk assemble them together into memory buffers of vertices and appearance attributes, then shovel only those buffers to OpenGL once per frame.


I assume frustum clipping is probably not your biggest concern, so I'd just ignore it for the most part by giving each object an artificially large bounding sphere.








On Sat, Jun 1, 2019 at 5:29 AM Yu Qi < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,
  By the way,the default vertex specification of geometry is displaylist,if you need to change vertex frequently,use VAO and VBO.

Thank you!

Cheers,
Yu

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76167#76167





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

------------------
Post generated by Mail2Forum
Back to top
axilmar
Newbie


Joined: 30 May 2019
Posts: 4

PostPosted: Mon Jun 03, 2019 8:30 am    Post subject:
Re: Huge perfomance issues
Reply with quote

Can you please elaborate? what do you mean by 'single object' and 'set this up to use buffer objects'?

Do you mean that a single OSG object can hold multiple VBOs or arrays of vertices?

Or do you mean to have a single vertex buffer and multiple OSG objects each one using part of that buffer?

Chris Hanson wrote:
I think I'd create a single object to represent ALL of the objects of a given class, eg Lines, PolygonLines, Rectangles, etc. Set this up to use buffer objects and it will refer to the buffer object to fetch the vertices, indices, and possibly attributes for the appearance.

Then on each frame after you have received ALL the data, bulk assemble them together into memory buffers of vertices and appearance attributes, then shovel only those buffers to OpenGL once per frame.


I assume frustum clipping is probably not your biggest concern, so I'd just ignore it for the most part by giving each object an artificially large bounding sphere.








On Sat, Jun 1, 2019 at 5:29 AM Yu Qi < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,
  By the way,the default vertex specification of geometry is displaylist,if you need to change vertex frequently,use VAO and VBO.

Thank you!

Cheers,
Yu

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76167#76167





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Mon Jun 03, 2019 11:58 am    Post subject:
Huge perfomance issues
Reply with quote

Well, I hadn't thought it through, but I think you could use a single VBO to hold, for example, all of the data for the Lines type objects. And another VBO to hold all the data for the Polylines, etc. So, one Object and one VBO to hold all the data for all the entities of each TYPE of Object. Then, you can bulk load the current data into the VBO, update the VBO to OpenGL, and let OSG draw it.

We're really just giving vague ideas here because we don't REALLY know the internal architecture of your existing code or what other constraints or restrictions might be in play that would affect the optimal solution.




If you want more in-depth advice, you'll probably have to explain more about your application. If you need to do that under NDA or confidentially, shoot me an email.




On Mon, Jun 3, 2019 at 10:31 AM Achilleas Margaritis < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Can you please elaborate? what do you mean by 'single object' and 'set this up to use buffer objects'?

Do you mean that a single OSG object can hold multiple VBOs or arrays of vertices?

Or do you mean to have a single vertex buffer and multiple OSG objects each one using part of that buffer?


Chris Hanson wrote:
Quote:
I think I'd create a single object to represent ALL of the objects of a given class, eg Lines, PolygonLines, Rectangles, etc. Set this up to use buffer objects and it will refer to the buffer object to fetch the vertices, indices, and possibly attributes for the appearance.

Then on each frame after you have received ALL the data, bulk assemble them together into memory buffers of vertices and appearance attributes, then shovel only those buffers to OpenGL once per frame.


I assume frustum clipping is probably not your biggest concern, so I'd just ignore it for the most part by giving each object an artificially large bounding sphere.








On Sat, Jun 1, 2019 at 5:29 AM Yu Qi < ()> wrote:


Quote:
Hi,
  By the way,the default vertex specification of geometry is displaylist,if you need to change vertex frequently,use VAO and VBO.

Thank you!

Cheers,
Yu

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76167#76167 (http://forum.openscenegraph.org/viewtopic.php?p=76167#76167)





_______________________________________________
osg-users mailing list
  ()
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)




--
Chris 'Xenon' Hanson, omo sanza lettere.  http://www.alphapixel.com/ (http://www.alphapixel.com/)
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel (https://twitter.com/alphapixel) facebook.com/alphapixel (http://facebook.com/alphapixel) (775) 623-PIXL [7495]

  ------------------
Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76175#76175





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts CPU Performance issues with AMD 2700 ... robertosfield General 10 Mon Apr 01, 2019 2:01 pm View latest post
No new posts Questions concerning Performance issu... Andrea74 General 3 Fri Dec 14, 2018 11:24 am View latest post
No new posts osgUtil::LineSegmentIntersector perfo... Andrea74 General 6 Tue Dec 04, 2018 4:09 pm View latest post
No new posts osg3.6.3 plugin issues jaisingla Plugins [osgPlugins] 3 Thu Oct 18, 2018 6:35 am View latest post
No new posts issues compiling 3.0.1 Lonnie.CTR.Souder General 2 Wed Sep 26, 2018 8:59 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP