[2.3] Sharing immutable index buffer. Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
przemir
Halfling
Posts: 68
Joined: Sun May 11, 2014 7:55 pm
Location: Poland
x 21

[2.3] Sharing immutable index buffer.

Post by przemir »

Hi,

I try to make particle system manager which holds particle pool and handles multiple emitter instances and particle system types. Hovewer, right now they are still bound to one datablock. I may make texture atlas, but different particle systems requires different blendblocks.

I can make multiple renderables, each associated with different datablock. I can't use the same vao, as primitive range can be different. Can I make one big enough immutable IndexBuffer (for quads) and share it among those renderable's Vao's? Will this be just one buffer on GPU side? I already get rid of VertexBuffer so it is IndexBuffer only.

Or maybe there is some alternative solution like sending multiple datablocks with one renderable?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.3] Sharing immutable index buffer.

Post by dark_sylinc »

You can create two VertexArrayObjects that point to the same vertex and/or index buffers without problem. This is allowed and it is how we handle LODs.

Just be careful when you destroy your vertex/index buffers that all VAOs using them have been destroyed first; and that you don't leak these vertex/index buffers once all your VAOs are destroyed.
przemir
Halfling
Posts: 68
Joined: Sun May 11, 2014 7:55 pm
Location: Poland
x 21

Re: [2.3] Sharing immutable index buffer.

Post by przemir »

Thanks for clearing this up.
Post Reply