Rendering optimization

I heard that fewer drawing calls = faster. The implied lesson is to collect as many vertex arrays as possible into several arrays in order to minimize the number of drawing calls.

I was thinking of writing a rendering structure on top of OpenGL to pack all the vertex data into a small number of arrays and draw the whole scene in just a few drawing calls.

My question is, is this really faster if you do an ALOT of a drawing in one call (e.g. in glDrawElements)?

I also heard that if you try to draw an oversized array of vertices with one call, it will overflow the cache and actually will not become faster.

+4
source share
1 answer

This article will be very useful for you: http://www.nvidia.de/docs/IO/8230/BatchBatchBatch.pdf

IMHO, you better optimize state changes. That is, minimize the number of times you need to switch shaders or textures, etc. These are β€œreal” expensive operations.

However, regarding your question. Rendering the number of vertices from a large vertex buffer (in my experience) is always faster than rendering from a few smaller ones.

I'm not sure about cache overflow. As far as I know, the vertex selection module extracts the vertices directly from the GPU memory (well, there is a vertex cache, but it is stored only in the order of 16 vertices). The only overflow you might have ends up from VRAM, after which you have more problems.

The only problem with large vertex buffers is that the driver will have problems moving them in memory. This is not a problem if your vertex buffers are static, but you can see some lower rates when changing data on the fly.

+4
source

All Articles