View Full Version : Speed of dynamic triangle soup

09-01-2002, 11:29 PM
Lets say I have 20.000 triangles that gets updated 50 times per second. What is the fastest way to render these triangles 5 times? I want to render them using 5 different materials etc..

Would it be faster to generate a display list the first time and then update them using display lists 4 times or should I use vertex arrays 5 times ?

09-01-2002, 11:55 PM
If you use VAR, I'd say go for vertex arrays. Other than that, just try out both versions and benchmark which one is faster http://www.opengl.org/discussion_boards/ubb/smile.gif

09-02-2002, 08:10 AM
If they are dynamic, and even if you will be rendering them 5 times, perhaps constructing display lists won't be such a good idea.

Constructing a display list each frame, is a no no!


09-02-2002, 12:42 PM
Why is it no no ? If I shall render the same contents 5 times using different material etc. , the driver could use the on GFX memory to store the triangle data, so I would logically benefit from using display list. I would not have to transefer the same contents 5 times from CPU to GFX mem

09-02-2002, 01:04 PM
Actually building the display list in the driver certainly aint for free ...

09-02-2002, 01:49 PM
Display list compilation can be exceedingly slow. It's definitely not designed to be used per frame, even though you are reusing it 5 times per frame. Display lists are designed to produce the fastest possible rendering performance, while not caring much about compilation performance.

As a point of reference, I have an app that generates display lists for models with on the order of 300,000 triangles. The display list compilation time for this is around .75 seconds. Adjusted down to 20,000 polygons, that would yield a max of about 20fps. Of course, my hardware is likely different from your own, or your target hardware, but you get the idea.

09-02-2002, 04:39 PM
If you don't want to use VAR, use LockArraysEXT(). That's what it's for -- submitting the same geometry more than once.

However, some implementations of LockArraysEXT() cut off any optimization at a fairly low number of verts (1000? 4000?) so you might want to slice it in a bunch of little arrays, iterating each material for each slice. Benchmark to be sure.

09-02-2002, 09:37 PM
Imagine what we could do together !

great response...

09-06-2002, 03:59 AM
If i have about 10.000 vertices. Will this not be accellerated by glLockArraysEXT ?

I do not get any speedup when the size is this big. Could you possible set this value max limit ?

09-06-2002, 06:05 AM
Will i benefit from dividing the trangle soup into smaller chunks of lets say 1000 vertices and the do lockArrays and then draw each subchunk several times

enstead of drawing the complete soup multiple times. The data will not change between each draw.

so instead of drawing 5x10000 i will draw 5x10x1000

09-06-2002, 06:03 PM
>>Will i benefit from dividing the trangle soup into smaller chunks of lets say 1000 vertices and the do lockArrays and then draw each subchunk several times<<

display lists and vertex arrays need to be keep under a certain limit
-eg from memory, my testing on my tnt2 DL's of 65kb will run about half speed of one 63kb.
-also check the drawrangeelements exten (or something) u can do a glGet..() to get the maximium recommended number of vertices/indices that u can pass in vertexarrays call. going above this limit will results in speed loss (sometimes quite a bit)
IIRC the tnt2's limit was 4096 for both

09-08-2002, 07:52 AM
I am a bit confused...

I don't get any sppedup of the glLockArraysEXT when i use it with my glDrawArray repeated 5 times.

The test scenario

1 .Setup vertex buffers. Only use float vertices and matrix weights. Use test data with 4095 vertices

2. Lock buffers.

3. use glDrawArrays to render the same buffer data 5 times.

4. unlock buffers.

Now why don't I get any speedup using locked buffers ?? I mean. The glDrawArrays only need to transfer the vertices once.....

Matt ? Any comments...

09-08-2002, 10:05 AM
drawarrays! so theres no shared vertices.
try drawelements
also try the quake3 format IIRC 4fV 2fT 2fT 4ubC even though nvidia said other formats will work (in the start this was the only one that did) from my testing a year or so ago i still found the quake3 format gives the best results.
check also oldish performance pdf's at the nvidia website something along the lines.

09-08-2002, 10:15 AM
The problem is that I have no time to create shared vertices. The buffers can not be indexed...

Won't the glLockArrays accellerate multiple drawarrays after each other with a locked scope ?

09-08-2002, 01:55 PM
LockArrays will help on non-T&L cards, and maybe help a little bit on some T&L implementations (such as 3dlabs?) but it doesn't help you on GeForce hardware, AFAIK.

Also, are you sure that you're vertex throughput bound? If you are, then perhaps making the vertices smaller (shorts instead of floats) will make it go faster. If you're not vertex throughput bound, then the size of your window will have a great impact on speed.

Anyway, for the best vertex throughput, you have to use GL_NV_vertex_array_range on nVIDIA hardware. Them's just the ropes.

09-08-2002, 05:10 PM
LockArrays is still better than not using it. (It lets you get the same benefits as DRE.) The only reason to use LockArrays over DRE is if you plan to render multiple passes with exactly the same arrays, i.e., multiple DE's within a single lock.

- Matt

09-08-2002, 09:41 PM
As you can see in my explanation , I am using it for multiple passes within the same lock. However why don't I get any speedup. Is it because I use vertexWeights ?

09-09-2002, 12:17 AM
You said DrawArrays -- we completely ignore LockArrays for DrawArrays.

- Matt

09-09-2002, 12:43 AM
Why ?

If i send the same array data multiple times, you must be able to use AGP mem or simillar to accellerate the same data ????

I beleeive it is vital in cases when you are unable to use indexed geometry but you want to use multpass or send same data multiple times to accellerate drawArrays !!

09-09-2002, 01:19 AM
The what can I do if I wan to resend the same buffers multiple times but using different model matrixes ,to get higher speed ?? I am not able to use idexed geometry..

09-09-2002, 03:33 AM
I'm going to ask the universal problem solving question here:

Why can't you use indexed geometry? Even if your surface topology is dynamic you could still generate indices in paralell with the geometry generation.

Of course, I have no idea what you're doing but I can't come up with a situation where it's *impossible* to use indexed geometry.

09-09-2002, 03:57 AM
Of course i can generate an index 0..9999 using values 0..9999 but this way i am gonna transfer more data only. Actually i did a test usin gthis but I only got lower perfromance even using glLoakArrays...

I am implementing VARs now to do the copy myself once..