How to draw one VBO at at time?

I have an application that will generate a 3D model for a dynamic 3D object (3D mesh + texture formatted as .obj file) at a time, so I end up getting a stream of 3D models (or 4D models?), and I want to display and render these time-series 3D models in real-time using OpenGL.

Being a newbie in OpenGL, I’ve tried and managed to display and render one 3D model with OpenGL by loading the .obj to a VBO and drawing it. But I am unsure how to draw and render a stream of 3D models? Specifically, assume that I have all 3D models available beforehand, how can I display and render each 3D model indexed by the time one by one? The next question is if the 3D model is provided on the fly, how can I do that in an online fashion?

I’m kind of stuck with this question for some time now, maybe because I don’t know exactly what to search for, it might be a term I have not heard of yet as most tutorials end after drawing one object to the screen using a VBO.

Thank you all in advance.

Could you provide some code of how you draw your VBOs currently?

In theory, you can create a different VBO for each object you want to draw, and during rendering, you bind only the one VBO for the object you want to draw.

But I am unsure how to draw and render a stream of 3D models? Specifically, assume that I have all 3D models available beforehand, how can I display and render each 3D model indexed by the time one by one?

Could you elaborate on “stream of 3D models”? It feels like you are not stuck on using VBOs, but stuck on how to create an array of objects and only draw one at a time, in an animation. Could you confirm if that’s the case?

whats with this tutorial?

by the way, you dont need 1 VBO per mesh …
https://www.khronos.org/opengl/wiki/Vertex_Rendering#Base_Index

1 Like

Thanks for replying. My application will feed me a 3D model (textured mesh) of a dynamic object at each time instance in frame rate. So at time t, I will get a 3D model, call it M_t. For the next frame, it will provide me with the next 3D model M_{t+1}. Hence, I end up getting a sequence of 3D models: M_t, M_{t+1}, … .This is essentially what I meant by “a stream of 3D models”. I apologize for not being clear.

What I want to do now is to just show/visualize these 3D models sequentially. Specifically, at time t, I receive and display M_t. For the next frame at time t+1, I receive M_{t+1} and display and render M_{t+1}. So on so forth. Because the 3D reconstruction application returns the 3D model of a dynamic object in real-time, I want to visualize and render the reconstructed object in real-time.

It feels like you are not stuck on using VBOs, but stuck on how to create an array of objects and only draw one at a time, in an animation

Yes, creating an array of objects and only drawing (and rendering) one at a time, in an animation, is exactly what I want to do. I will provide some code as soon as possible.

Thanks a lot.

if thats the case, you still dont need several VBOs. instead, put each frame the new mesh into the old buffer and draw it as usual …

if you want to keep the old meshes, then keep track of vertex/index buffer offsets, put the new mesh into VBO, and draw the range of the mesh vertices/indices as describes in the 2nd link i posted previously

I see what you mean. Will give it a try soon. Many thanks.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.