PDA

View Full Version : Size of VBO



greg2
05-07-2007, 05:31 AM
Hi,

i have a simple question:

Is there a limit for the size of a vbo ?

If i have to store 1000 vertices from several different meshes (1000 is just an example), is it possible to have enough space to store it in 4 differents VBO of 250 vertices, but not enough space to store it in 1 VBO of 1000 vertices ?

Thanks.

Zengar
05-07-2007, 05:50 AM
There is no "real" limit (the limit depends on your RAM and VRAM). Still, it may be possible that the driver fails to allocate the memory, then you will get an error when creating the VBO.
IMHO, you can safely allocate VBOs under several megabytes.

k_szczech
05-07-2007, 06:09 AM
is it possible to have enough space to store it in 4 differents VBO of 250 vertices, but not enough space to store it in 1 VBO of 1000 vertices ?
Yes - due to memory fragmentation, but it's more likely that least recently used resource will be dropped to system memory and your VBO will be created.
Although with just 1000 vertices you should be fine.

If you're not developing an application with high security and reliability requirements you shouldn't bother.
If you do develop such application then you shouldn't rely on what people say and assume every operation can fail anyway :)

greg2
05-07-2007, 07:07 AM
Thanks.

Acctually, i want to display a 3d scene fom Anim8or ( a free modeler).

A scene has several instance of an object. And one object can have 1 or more meshes. But all meshes are static in the objects spaces (i just need position and orientation matrices for objects but not for meshes).

I wonder if the best thing to do is to store the vertices of meshes in one vbo per object or one vbo per meshes (using index buffer to select the good chunk for each materials).

Because i have read that it is slow to bind a ressource in OpenGL or D3D (texture, VBO, ...).

If i have understood, if i use several VBO, the "bind" operation will slows down my application.
But if i use just one VBO, and if there is not enought space in video memory, it will be store in system memory and it will also be slow.

k_szczech
05-07-2007, 07:26 AM
But if i use just one VBO, and if there is not enought space in video memoryAnd how large would that VBO have to be?
A good approach is to use one VBO for multiple objects (let's say you application will store minimum 10k vertices per VBO) and when you run out of space in one VBO you create another and so on.

That's for viewing. For modelling it's best to use one VBO per mesh since it's easier to manage.

greg2
05-07-2007, 07:51 AM
Ok. Thanks.