Hello,
I have trouble in changing OpenGL code to Irrlicht. I don't know how to change the below code to Irrlicht. Would you let me know how to convert OpenGL code to Irrlicht?
for(int i = 1; i < NUM_LINKS; i++)
{
glPushMatrix();
glTranslatef(t[0], t[1], t[2]);
glRotatef(angle, axis[0], axis[1], axis[2]);
glCallList(meshList + i);
glPopMatrix();
}
=> It didn't work. ^^;;;
for(nCnt = 1; nCnt < NUM_LINKS; nCnt++)
{
jointPos = vector3df(t[0], t[1], t[2]);
rot.fromAngleAxis(angle, vector3df(axis[0], axis[1], axis[2]));
rot.toEuler(jointRot);
ptrSceneNode = g_ptrSmgr->getSceneNodeFromId(nCnt);
ptrSceneNode->setPosition(jointPos);
ptrSceneNode->setRotation(jointRot);
}
glRotate and glPushMatrix
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The code should be quite ok, however you're dealing with different coordinate systems here. OpenGL uses a right-handed y-up, while Irrlicht uses left-handed. This means that you have to negate one or all three coord elements of a vector. Rotations are much more involved, although using angle and axis should work almost the same: Invert both the axis and the angle.
Maybe you can also write up your current results so we can know how much is already working. Maybe using a skeletal animation would be also much simpler.
Maybe you can also write up your current results so we can know how much is already working. Maybe using a skeletal animation would be also much simpler.
I changed the code like this. But it doesn't work.hybrid wrote:The code should be quite ok, however you're dealing with different coordinate systems here. OpenGL uses a right-handed y-up, while Irrlicht uses left-handed. This means that you have to negate one or all three coord elements of a vector. Rotations are much more involved, although using angle and axis should work almost the same: Invert both the axis and the angle.
Maybe you can also write up your current results so we can know how much is already working. Maybe using a skeletal animation would be also much simpler.
rot.fromAngleAxis(angle, vector3df(-axis[0], axis[1], -axis[2]));
Are you both co-workers somehow?
Generated Documentation for BlindSide's irrNetLite.
"When I heard birds chirping, I knew I didn't have much time left before my mind would go." - clinko
"When I heard birds chirping, I knew I didn't have much time left before my mind would go." - clinko