Hi Everyone.
I'm currently translating an application using ODE and glut to ODE with OpenSG.

Everything works fine except the rotations and scaling of my objects, I have a function handleTransform wich gets 2 arrays and sets them in their proper locations in the model view matrix.
So basicaly I want to translate this glut/ODE code to OpenSG/ODE:
 
  glPushMatrix();
  handleTransform(wheelrot, wheelpos);
  glScalef(1, 1, 0.2);
  glutSolidSphere(radius, 10, 10);
  glPopMatrix();

The above snippet of code draws one of the wheels of my simulated car.

So I changed handleTransform to work with the OpenSG rotation-scale-translation matrix:

Matrix handleTransform(const dReal *rot, const dReal *pos)
{
  Matrix m = Matrix(rot[0], rot[1], rot[2], pos[0],
                    rot[4], rot[5], rot[6], pos[1],
                    rot[8], rot[9], rot[10], pos[2],
                    0, 0, 0, 1);
  return m;
}

This way I can draw my objects in a similar way to this:

beginEditCP...
{
m = handleTransform(wheelrot, wheelpos);
m.setScale(1, 1, 0.2)
tChasis->setMatrix(m);
}
endEditCP......

Which I believe is correct, because the rotations work correctly, but the painted objects won't behave adequately (the movement is all weird). I guess that my problem is scaling, so I wanted to know how can I preserve the initial scaling throughout the execution so the shape of my wheels is preserved as in with glut.

Thanks a lot.

Juan.

Reply via email to