View Full Version : Showing subset of currently rendered objects
03-05-2012, 07:43 AM
I have a scene in which I have a bunch of point sprites rendered (~50k), and I have lines connecting these point sprites. Currently the lines are compiled to a GL list.
In my app, the user can apply some functions that hide some of the point sprites (no new ones are added, just a subset of the original are being shown). For the ones that are filtered out, I don't want to show the lines between them.
Is there a way I can filter out some of those lines, without recreating the whole list? This can happen frequently, so I don't want to be recreating the list of lines every time.
03-05-2012, 10:57 AM
Maybe you can use the geometry shader to filter what lines shall be visible?
03-05-2012, 12:29 PM
Thanks. I'm still a bit of an OGL beginner, so I'll look into that and see how it applies here...
03-05-2012, 02:39 PM
Alternatively: get rid of the display list and instead use a VBO for vertex data and another buffer object for the index. When the set of visible objects changes create a new index and upload it.
03-05-2012, 03:15 PM
I'm not sure I follow the part about creating another buffer object for the index. Are you suggesting creating a buffer that has the indices of the objects that need to be drawn? Then just update that and redraw those indices?
03-05-2012, 03:36 PM
Well, OpenGL does not operate at the level of what one usually thinks of as "objects", it only knows it's rendering primitives (points, lines, triangles). So for example a line between two points requires two indices (of the start and end point). But other than that, yes, the idea is to only change the contents of the buffer to contain only those indices that you need to draw.
Actually, looking back at your original problem description: if the set of lines to draw only changes on user input (i.e. < 1 per frame), just rebuilding the list should not be so bad either.
03-06-2012, 05:03 AM
Thanks for the correction in terminology - I did mean primitives.
In general, it will be less than once per frame, though we have some cases where it could be slightly more. I will just start with rebuilding the list and measure performance first, then go from there.
Appreciate the input.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.