[osg-users] frame control and callback
matthieu.dirrenberger at ersa-france.com
Tue Sep 30 06:57:43 PDT 2008
Hello OSG users,
I am a new on OSG and I have some difficulties to finish an application.
I am trying to do an application which computes pre-calculated
height-maps from a scene.
Simply, I make a "draughtboard" from the scene; and a camera takes shots
from Z-buffer for each square looking downward.
I have done a callback function to get z-buffer and convert it to my
convenience, but I can't control the execution of that callback
struct MyCameraPostDrawCallback : public osg::Camera::DrawCallback
MyCameraPostDrawCallback(osg::Image* image, osg::Image* cimage,
osg::Texture2D* t): _image(image), _cimage(cimage), _cTex(t)
virtual void operator () (const osg::Camera& /*camera*/) const
I use this function to init the callback in the camera settings:
After that, I use loops to modify camera positions and take my shots (I
make a code based on the example from OSG user guide using
yf = yd+TEXT_SIZE;
camera->setClearColor(osg::Vec4(0.1f,0.3f,0.3f,1.0f));//init buffer de
The problem is to takes a shot using the callback function for each
frame with the new camera position.
I thought that draw a frame should calls the Camera::DrawCallBack
function, but it doesn't...
I always get the last square from the loops in my images buffer (at each
In fact the callback function is called after the loops in spite of
Can you help me? I am not sure to use the right method...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users