Is there an example of class implementation of the btStridingMeshInterface that actually uses the concept of mesh sharing (graphics/physics/collision) in bullet? Specifically, I'm looking for an example on how to point the collision engine to specific OpenGL buffers on the GPU that can be changed by the user and/or physics engine, while the Bullet collision engine always uses the latest state of that buffer (e.g. just a triangle mesh).
Thanks!
--nico
btStridingMeshInterface example with mesh sharing
-
- Posts: 11
- Joined: Wed Dec 06, 2006 1:59 am
- Location: Chapel Hill, NC
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btStridingMeshInterface example with mesh sharing
The mesh sharing can happen between physics engine, and graphics mesh in main memory.ngaloppo wrote:Is there an example of class implementation of the btStridingMeshInterface that actually uses the concept of mesh sharing (graphics/physics/collision) in bullet? Specifically, I'm looking for an example on how to point the collision engine to specific OpenGL buffers on the GPU that can be changed by the user and/or physics engine, while the Bullet collision engine always uses the latest state of that buffer (e.g. just a triangle mesh).
Thanks!
--nico
See the Demos/VehicleDemo how to share existing index/vertex array from main memory (potentially graphics data).
If you really need GPU vertex data, you probably have to unlock/lock the data. In that case, you can implement such interface, by deriving from and implement the GPU -> main memory in getLockedVertexIndexBase (from GPU to main memory) and unLockVertexBase (unlocking, as there is no effect from physics to graphics).
Hope this helps,
Erwin
-
- Posts: 11
- Joined: Wed Dec 06, 2006 1:59 am
- Location: Chapel Hill, NC
Re: btStridingMeshInterface example with mesh sharing
Thanks! Very useful...Erwin Coumans wrote: See the Demos/VehicleDemo how to share existing index/vertex array from main memory (potentially graphics data).
Hope this helps,
Erwin
--nico