View Full Version : Too many objects
11-15-2005, 02:21 AM
I have 250,000 not same objects that have lines, rectangles, cicles.
My problem that when I draw it in primitive way it takes 30 seconds... I need it in 0.30 seconds.
How can I do this?
Give more information: what real GL primitives do you use: lines, triangles, triangle strips, quads... ? Do you render in immediate mode, or do you compile all in display lists ? Or do you use vertex arrays ?
Also, what graphic card do you have, what version of GL do you support...
11-15-2005, 03:15 AM
I am using primitives: points, lines, quads.
Right now I am using the immediate mode. I have tryed to compile to the display lists but it takes 30 seconds to convert to it and after it this takes me 15 seconds to draw the all objects by calling the display lists.
I have one of newer nvidia graphic card with 256MB (the time, that I give, is took from nvidia graphic card). I also tryed to run on computer (the laptop) with ati graphic card with 32MB (on this card it worth than on vidia).
11-15-2005, 04:26 AM
250000 objects is very much, you need to reduce that number. There is no problem sending millions of triangles to the card, as long as they come in sufficiently large batches. But sending 250000 small (tens to hundreds of triangles) batches is never going to work well.
If only a fraction of all the objects are visible in each frame, add frustum culling with a hierarchical structure (like an octree or a kd tree), to reduce the number of objects actually sent down the pipeline.
If you really need to draw (almost) every object in every frame and the objects don't move independently, you could try to batch objects. Take objects that are sufficiently similar (same material properties, same texture, etc) and merge them into a single object.
Did you tried to make many display lists, or was it a big one ? Try to make many of them for each objects.
Also, vertex arrays (and more VBO) should give best results.
However, I'm pretty sure, with all your objects, that you consume the fillrate of your card. You'll then need other technics like frustum culling, occlusions queries or so. There's a recent topic about occluions queries, have a look at it.
11-15-2005, 04:41 AM
I draw the all objects at all frame.
The question is: Can I draw the delta only of the draw?
In some frames I change the screen like open window over the opengl viewing. Or change only few lines on the screen.
Also I am use a few colors (about 20-25 colors) - May be it will be faster to use index table for colors?
No you cannot update what only changed, you must give all what you want to be draw for each frame.
Using index color is generally not faster, and will also generally prevent you from using other interresting stuffs (haven't them in mind however).
11-15-2005, 06:15 AM
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.