Is it quicker, to add all the vertexes of my geometry to one VBO every frame and render it, or use immediate rendering mode?
I ask as I’m facing an issue at the moment where immediate mode rendering is just as fast as my VBO rendering.
Try not to use immediate mode. If you need to update vertex data every frame look into vertex arrays. VBOs are usually used for mostly static geometry that doesn’t change so often.
As the previous poster said, VBOs should be much faster than immediate mode for static geometry, so if you’re not seeing any performance gains I can only suggest you’re doing something wrong or your geometry is very dynamic?
It’s not that simple, actually. In some edge cases immediate mode still outperforms the most optimized VA/VBO strategy. That said, in any realistic scene, immediate mode will bite the dust.
So is it very efficient to add all the vertices to a VAO, lets say 60 times a second, then render it, or use immediate mode?
When left with no other option, it’s perfectly acceptable to buffer data often, even every frame. When calling glBufferData, it’s best to set the usage to GL_Dynamic_Draw.
You can also use glBufferSubData to update only a portion of the buffer instead of the whole thing. You can also use glBufferSubData to replace all the data and this will avoid some reallocation.
I believe there are also some tricks involving glMapBuffer, but I’m not too familiar with them.
I’ve done some stress testing with rebuffering every frame (~60 fps) and found you can swap out quite a bit of data before you start to see a frame rate decrease.
That being said, I only recommend this as a last resort; be sure there isn’t a way to buffer the data less frequently and manipulate it with matrices.
In almost every practical case it will be better to use VAOs or VBOs.
The “modern GL” approach is to use something like geometry shaders, instanced drawing, or transform feedback, but this isn’t always ideal for scenes with many dynamic 2D sprites, nor is it possible in OpenGL ES (mobile).
The best solution is to use something like LibGDX, which is already highly optimized and uses VAOs and VBOs under the hood.