Quote: "
Is it possible that the crate model you load contains more than one limb?
"
Yes, this was the reason of the problem.
And here is my solution:
#include <DarkGDK.h>
int nObjectCube=1;
int nObjectSphere=2;
int nMeshSphere=1;
int nLimb1;
int nLimb2;
int nLimbsCount;
int nImageCrate = 1;
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate(60);
dbSetWindowOn();
dbSetDisplayMode(800, 600, 32);
dbAutoCamOff();
dbColorBackdrop( dbRGB(0, 0, 0) );
dbPositionCamera(0,0,-5);
dbLoadImage( "../Media/Crate.jpg", nImageCrate );
dbLoadObject( "../Media/Cube.x", nObjectCube );
dbTextureObject( nObjectCube, nImageCrate );
// advance to the first available limb
dbPerformCheckListForObjectLimbs( nObjectCube );
nLimbsCount = dbChecklistQuantity();
nLimb1 = nLimbsCount;
nLimb2 = nLimb1 + 1;
dbMakeObjectSphere( nObjectSphere, 0.5f );
dbMakeMeshFromObject( nMeshSphere, nObjectSphere );
dbAddLimb(nObjectCube, nLimb1, nMeshSphere);
dbAddLimb(nObjectCube, nLimb2, nMeshSphere);
dbDeleteObject(nObjectSphere);
dbDeleteMesh(nMeshSphere);
dbOffsetLimb(nObjectCube, nLimb1, -1.0f, 0.0f, 0.0f);
dbOffsetLimb(nObjectCube, nLimb2 , 1.0f, 0.0f, 0.0f);
dbColorLimb( nObjectCube, nLimb1, dbRGB(255,0,0) );
dbColorLimb( nObjectCube, nLimb2, dbRGB(0,255,0) );
while ( LoopGDK ( ) )
{
dbSync( );
}
}