Ask Your Question

Revision history [back]

Copy and paste example given in this link there is no problem :

void ClavierViz(const viz::KeyboardEvent    &k,void *c)
{
    int *i=(int*)c;
    if (k.code=='1')
        *i=*i-1;
    else if (k.code == '2')
        *i = *i + 1;
}

.....

int indCam=0,indRef=indCam;
fen3D.setViewerPose(path[indCam]);
fen3D.registerKeyboardCallback(ClavierViz, &indCam);
do 
{
    if (indRef==indCam)
        fen3D.spinOnce(1,false);
    else
    {
        if (indCam>= path.size())
            indCam=0;
        else if (indCam <0)
            indCam = path.size()-1;
        indRef=indCam;
        fen3D.setViewerPose(path[indCam]);
        fen3D.spinOnce(1,true);
    }
} while (!fen3D.wasStopped());