Vertex arrays

Started by
7 comments, last by NeXius 21 years, 5 months ago
Hi If I''m using triangle strips to render a terrain, how much of an advantage would it be to convert it to vertex arrays? I know vertex arrays render faster because it doesn''t have to position each vertex every time... but same with triangle-strips, right?
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
Advertisement
Use both. Vertex arrays are really fast. (I think you can use both at the same time, right?)
Say you have 10000 vertices. With vertex arrays, you make one function call. With glVertex3fv or whatever, you make 10000 function calls. That's a lot of needless data pushing!

Raj

[edited by - Rajansky on November 10, 2002 12:32:38 AM]
Ok, but wouldn''t it be the exact same if I just used triangles with vertex arrays? Instead of triangle-strips with vertex arrays?

This might make things simpler for LOD...
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
a vertex array of tri_strip is going to be faster than a vertex array of triangles. think of it from a bandwith perspective. is it faster to push 10,000 vertices (gl_triangels) or 10,000/2 vertices (gl_triangle_strip) to your graphics card?

-me
quote:Original post by Palidine
a vertex array of tri_strip is going to be faster than a vertex array of triangles. think of it from a bandwith perspective. is it faster to push 10,000 vertices (gl_triangels) or 10,000/2 vertices (gl_triangle_strip) to your graphics card?

-me


hummm this got my attention... and yes the triangle_strip will be faster.. anyways where can i find tutorial on vertex arrays ?
Metal Typhoon
A while ago, I was rendering a simple landscape using vertex arrays and triangle strips. Specifically, though, the camera was on the landscape, and I was only rendering a square-sized chunk of the landscape centered around the camera.

I was using vertex arrays to do this. When I tried running the engine on my friend''s Voodoo 3, I noticed massive chunkiness. When the camera got moved around, apparently the card was really unhappy with the switch in which parts of the vertex array it was rendering. Switching over to regular triangle strips solved the problem and improved the framerate by like 3x.

Anyway, moral of the story is, do yourself a favor and check to see that the vertex arrays are actually helping things before you decide whether to use them or not.
You don't need to vote for the "lesser of two evils"! Learn about Instant Runoff Voting, the simple cure for a broken democracy!
Hmm, I''d make sure you''re using your vertex arrays properly before dismissing them as a performance gain.

Try to calculate how much memory your vertices take up - if you''re using a big triangle strip, looking in the wrong direction can be very cache-unfriendly. Perhaps splitting the terrain into smaller chunks would be much faster.

You can also do visibility culling this way.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Vertex arrays are *always* faster than glVertex() type calls, once you got over the break even point in terms of facecount (approx. 100 faces). They have to be used in the right way, of course (esp. no repopulation every frame, that''s a common mistake for beginners).

About tristrips vs. triangles: they are only faster with respect to transfer bandwidth (tristrips use less bandwidth). Once they are on the 3D card, they are exactly the same speed.
Repopulation every frame? I''m sorry, I am a beginner at vertex arrays, do you mean storing the vertex information on the video card once and then each frame deciding which vertices(triangles) to render?

This topic is closed to new replies.

Advertisement