vbo - OpenGL: efficient way to render a batch of geometry? -


This is something I was looking for at that time, but I have not found any concrete information or good examples yet. Are there. I say, what is the effective way of rendering a bunch of unrelated objects (for example triangle strips)?

I've heard about putting several objects in a VBO to reduce open GL calls, but have not seen the exact example of how to do it. I have also seen posts that oppose this idea. So right now, I'm mostly just confused.

First of all, you should probably use VBO to use all the paws. For small and large objects.

Then, the second issue is "How many different things to add to a big object?" - so that the number of OpenCL calls can be reduced. Generally, objects using the same texture, physical settings and shaders can be added as if you lie around many similar aksharees, then combine them into several large "crate piles" The meaning can be.

If an object is a triangle list, then the combination is easy - just create a big triangle list out of the source list if any object is a triangle strip, then you need to enter the strips of "triangle triangle" (It is a very useful optimization for a single object, even if it can not be displayed as a single bar).

A "degenerate triangle" is a triangle with two or three identical top indexes. Graphics hardware can recognize them and leave them very fast.

So if you have, eg

The index of the original triangle of strips will be:

  1) 0, 1, 2 2) 0, 1, 2  

Now you are connected together in all corners, so you end up with 6 corners.

  1) 0, 1, 2 (unchanged) 2) 3, 4, 5  

So far you have a top array, but still The two different strips have to be inserted by diluting the triangle:

  1) 0, 1, 2, 2, 2, 3, 4, 5  

< Em> (I think the above is true, but not actually verified)

This idea: With the above bar, the graphics card will remove the triangle from these corners:

  0, 1, 2 1, 2, 2 & lt; - degenerate! 2, 2, 2 & lt; - Will not be deanerate! 2, 2, 3 and lieutenant will not be removed - fall! 3, 4, 5  

In general case, you will either place two or three thin triangles based on the original strip length, so that triangle rotation is correct.


Comments