btTransform and OpenGL

vaxon
Posts: 4
Joined: Wed Jul 24, 2013 9:52 pm

btTransform and OpenGL

Post by vaxon »

Just another stupid question from a newbie here :)
Is there a sort of "OpenGL-optimized" version of btTransform.
Bullet uses (row-major) internal data storage for btTransform (and btMatrix3x3).
So we have to call getOpenGLMatrix() to export it to a temporary column-major matrix to be later passed to OpenGL.
Would it be possible to have bullet use column-major matrices in the first place and map them to an OpenGL float* (reinterpret_cast) to eliminate the copying?
Would it give us any performance gain?
Just wondering if anybody has already experimented with it and if it's possible.

Thanks,
V.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btTransform and OpenGL

Post by Erwin Coumans »

I wouldn't worry about the minor conversion cost, your application CPU cycles are most likely happening elsewhere.

OpenGL uses a 4x4 matrix. Bullet uses a 3x3 matrix and a position vector, it is different. In Bullet 3.x we are using a quaternion and position, so we still need the conversion anyway.
vaxon
Posts: 4
Joined: Wed Jul 24, 2013 9:52 pm

Re: btTransform and OpenGL

Post by vaxon »

Thanks!