Sign in to follow this  
challenge

Dynamic VBO vs VAO

Recommended Posts

challenge    100
Hello everybody!

I have a dynamic VBO and I need to change all content and also the size EVERY FRAME. In order to rebuild VBO I have to build an vertex array with all data. Is VBO better over VAO only because it's using video card memory, or does it have other advantages? I'm asking this because I also can use that VAO instead of VBO so I don't need to transfer data to video card. I have made some tests with my particle engine (where now I use a VAO to send points to the shader) but no clear result, I get around 18 fps with both VAO/VBO when sending lots of points.
What is the best solution? VBOs for static stuff and VAO for dynamic or is there another way?

Thank you in advice and sorry for my english

Share this post


Link to post
Share on other sites
apatriarca    2365
First of all, VAO is probably not what you are thinking about (look [url="http://www.opengl.org/wiki/Vertex_Array_Object"]here[/url]). It's VA (vertex arrays) without the O.

What do you mean by changing the size of the buffer every frame? What you should do is using a fixed size VBO (the maximum size you want to support) and then only use a part of it (sending the data with glBufferSubData). How do you create the VBO? Are you using the correct GL_STREAM_DRAW usage flag?

Share this post


Link to post
Share on other sites
challenge    100
[quote name='apatriarca' timestamp='1308496937' post='4825093']
First of all, VAO is probably not what you are thinking about (look [url="http://www.opengl.org/wiki/Vertex_Array_Object"]here[/url]). It's VA (vertex arrays) without the O.
[/quote]
Sorry, I misunderstood what VAO means, I wanted to say Vertex Array.

[quote name='apatriarca' timestamp='1308496937' post='4825093']
What do you mean by changing the size of the buffer every frame? What you should do is using a fixed size VBO (the maximum size you want to support) and then only use a part of it (sending the data with glBufferSubData). How do you create the VBO? Are you using the correct GL_STREAM_DRAW usage flag?
[/quote]
No, I dont use GL_STREAM_DRAW, instead I use GL_DYNAMIC_DRAW, however it works as it is supposed to. Thank you anyway, I didn't thinked about the fixed size VBO.

[font="arial, verdana, tahoma, sans-serif"] [/font][font="arial, verdana, tahoma, sans-serif"] [/font]

Share this post


Link to post
Share on other sites
Danny02    279
1. use [size="2"][color="#1c2837"]stream instead of dynamic, these flags are only optimization flags for the driver so it will work with any flag, but u can get better performance when u choose the right one.[/color][/size]
[size="2"][color="#1c2837"]
[/color][/size]
[size="2"][color="#1c2837"]2. best use first glBufferData with "null" as data and the glSubBuffer for uploading(this is faster then using only subBuffer cause the driver don'T have to wait until all draw calls to the old data has finished)[/color][/size][color=#1C2837][size=2].[/size][/color]
[color=#1C2837][size=2] I Think when u do this u won't need to use always the same buffer size.[/size][/color]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this