From: Boris Mansencal (boris.mansencal++at++inria.fr)
Date: 04/16/2002 02:39:41
Hi,
I have written some code to move a pfFCS between two matrices, based on
pfEngine
(you can find the code below). But I get the following error message :
PF Info: pfFlux::getCurDate could not find
readable buffer.
PF Returning oldest buffer.
PF Perhaps numBuffers should have been
higher
PF to handle multiprocessing model.
First I think there is an error in the message itself : it is
pfFlux::getCurData
and not pfFlux::getCurDate, isn't it ?
Does anyone have any idea why I get this message ?
What are the possible non-obvious reasons ?
I create all my pfFlux with PFFLUX_DEFAULT_NUM_BUFFERS, so I should not
get
this message ...
Here is the code I use to implement my animation.
It works as follow : I call a->animate(mat1, mat2) and
it triggers an animation between mat1 and mat2.
class A : public pfObject
{
public:
~A();
A(pfFCS *fcs, int length);
void animate(const pfMatrix &startMat, const pfMatrix &endMat);
protected:
friend void animFunc(pfEngine *eng);
void doAnim(void);
protected:
pfFCS *_fcs;
pfFlux *_frameTimeFlux;
pfEngine *_animEngine;
float _startTime;
float _length;
pfMatrix _startMat;
pfMatrix _endMat;
};
A::A(pfFCS *fcs, int length)
: _fcs(fcs), _length(length)
{
assert(_fcs != NULL);
assert(_length != 0.0);
_frameTimeFlux = pfGetFrameTimeFlux();
_animEngine = new pfEngine(PFENG_USER_FUNCTION);
_animEngine->setDst(_fcs, NULL, 0, 0);
_animEngine->setUserFunction(animFunc);
_animEngine->setUserData(this);
}
void
A::animate(const pfMatrix &startMat, const pfMatrix &endMat)
{
_startMat = startMat;
_endMat = endMat;
_startTime = *(float *)_frameTimeFlux->getCurData();
_animEngine->setSrc(0, _frameTimeFlux, NULL, 0, 0, 0);
}
void
A::doAnim()
{
float time = *(float *)_frameTimeFlux->getCurData();
time -= _startTime;
if (time <= _length) {
time /= _length;
pfFlux *f = _fcs->getFlux();
pfMatrix *matCur = (pfMatrix*)f->getWritableData();
interpolateMat(_startMat, _endMat, time, *matCur);
}
else
_animEngine->setSrc(0, NULL, NULL, 0, 0, 0);
}
void
animFunc(pfEngine *eng)
{
A *a = (A *)eng->getUserData();
a->doAnim();
}
Is there a better way to do that in OpenGL Performer ?
only with one function call ?
Thanks for any help.
Boris.
-- Boris Mansencal INRIA Rocquencourt (France) - projet i3D http://www-rocq.inria.fr/i3d/ mailto:boris.mansencal++at++inria.fr - Tel: +33 1 39 63 59 03
This archive was generated by hypermail 2b29 : Tue Apr 16 2002 - 02:47:54 PDT