[ODE] Problem's when profiling graphics engine
Kyle Hubert
khubert at gmail.com
Tue Dec 12 04:15:47 MST 2006
On 12/12/06, Andreas Fredriksson <deplinenoise at gmail.com> wrote:
> On 12/12/06, Kyle Hubert <khubert at gmail.com> wrote:
> > I'm profiling my application and got interesting results. This is my
> > worst funtion and eating 40% of my time:
> >
> > /* Convert ODE's rotation matrix and pos into a GL matrix */
> > void convert_ode_to_gl(float *m, const float *p, const float *r) {
> > m[0] = r[0]; m[4] = r[1]; m[8] = r[2]; m[12] = p[0];
> > m[1] = r[4]; m[5] = r[5]; m[9] = r[6]; m[13] = p[1];
> > m[2] = r[8]; m[6] = r[9]; m[10] = r[10]; m[14] = p[2];
> > m[3] = 0; m[7] = 0; m[11] = 0; m[15] = 1;
> > }
> >
>
> Looks like you're transposing ODE's matrices to change handedness
> before uploading them to OpenGL? If so, I would recommend you look in
> the the OpenGL extension (standard in 1.5 IIRC) that lets you upload
> transposed matrices instead. Many GL drivers can do clever things with
> that anyway so you don't have to :-)
>
> http://oss.sgi.com/projects/ogl-sample/registry/ARB/transpose_matrix.txt
Thanks, that helped. Unfortunately, I still have to do the memcpy
since the rotation matrix is a dMatrix3. I recompiled with a dMatrix4
(with some hacking) and now I can just directly input to
glMultTransposeMatrixf the return from dGeomGetRotation. It saves me
up to 4us per iteration depending on cache effects for this extra
hack. (In total I now save up to 7us).
Thanks again.
-Kyle
More information about the ODE
mailing list