Assume that I have M polygons which have some shape and vertices order.
If I create a vbo for every polygon, then I have M vbos.
When I want to draw them, I have to achieve a M loop on my cpu. It's too slow due to M is too large.
So I want to create just one vbo to store all polygon's vertices.
But when I want to draw a vbo using GL_POLYGON, the opengl will regard all vertices in this vbo as vertices in one polygon.
So the output is that multiple polygons is unioned, which is not excepted.
So my question is that how can I separate multiple polygon vertices in one vbo.
I know that if I regard each polygon as mutilple triangles and store the corresponding indexs of vertices in a ebo is work.
But this method may not work for multiple lines and there are time cost for triangulation.
But I think there should be a more sutiable method.
0
votes
I dont fully understand it, you want: a) Have all your mesh data in a single buffer (possible and best practice)? b) Draw all your meshes (which are in a single buffer) using a single draw call, avoiding to loop over them?
- Nadir
Yes, I want both a and b.
- hao li
You might want to check out indirect rendering
- BDL
1 Answers
1
votes
Store all vertices in a single vbo (as you mentioned in your question).
Then you can draw them all at once with glMultiDrawArrays
(documentation and further explanation).