Hello Jie,

Jie Liu wrote:
> I would like to modify the camera settings of a SimpleSceneManager (SSM) 
> object, in this way:
> 
>     MultiDisplayWindowPtr MDWndPtr = MultiDisplayWindow::create();* // a 
> multi display window is involved*
>     /* initialize multi display window
>         ......
>      */
> 
>     g_SceneManager = new SimpleSceneManager;
>     g_SceneManager->setWindow(MDWndPtr);
>     g_SceneManager->setRoot(g_SceneRoot);
> 
>     g_SceneManager->showAll();
> 
>     PerspectiveCameraPtr ptrCam = g_SceneManager->getCamera();
>     beginEditCP(ptrCam);
>     ptrCam->setFov(deg2rad(90));
>     endEditCP(ptrCam);
> *    g_SceneManager->setCamera(ptrCam);*  // this line will cause a 
> corruption of the heap

you don't need to set the camera again, since you are not replacing the 
existing camera with a different one, but only change its parameters [1].
Incidentally this triggers a bug in the SSM, because setCamera does not 
check against the new camera being the same as the old and at the end 
has this sequence:

subRefCP(_camera);
_camera = newCamera;
addRefCP(_camera);

which kills the camera object if newCamera == _camera. I just committed 
a fix for that.

        Cheers,
                Carsten

[1] in fact, setting the camera copies the beacon, near, far and fov 
from the existing camera, so that is not what you want ;)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to