# How can deal with batch rendering when the elements in the batch changed every frame?

Since I am using batch rendering, so I should pack every render units can be batched into one big VBO. But, what if I am in a case where render units are dynamically changed, some new units are added in, and some units are subtracted out. So I should reconstruct my VBO again and again in very frame. So here is the question.

Should I allocate a big enough storage in the first time and update the data in it, and only reallocate when run out of the storage, or allocate storage according to the size on demand in each frame?

• I thought you said, "I will avoid asking more than one question once time later." That rule doesn't only apply to SO; it's all of our sites. Also, all of the other questions asked about that question still apply. – Nicol Bolas Jun 8 '17 at 17:26
• Actually, this posting is before that comment I replied.@NicolBolas – Francis Jun 9 '17 at 2:56

To be more specific: for data that will be updated every frame, you probably want to initialize it using glBufferStorage with GL_DYNAMIC_STORAGE_BIT (or, if you're on an older OpenGL version, glBufferData with GL_DYNAMIC_DRAW). Then, to update it each frame, use glMapBufferRange with GL_MAP_INVALIDATE_BUFFER_BIT. This should be an efficient, fast path in the graphics driver.