[osg-users] addSlave messup main cameras stateset

Robert Osfield robert.osfield at gmail.com
Tue Apr 19 01:37:20 PDT 2011


HI Suneel,

>From reading your post there is no way I can guess what is going on in
your app.  There is no reason for the OSG to detach a StateSet from a
master Camera so would presume there is something wrong in your code,
as to what I can't not guess as there is too little information.  I
would recommend just stepping through you app and double check all the
code and assumptions you are making.

Robert.

On Tue, Apr 19, 2011 at 6:15 AM, suneel suresh <compressor at gmail.com> wrote:
> hi in order to display a rectangle roi over the 3d scene i use the example provided in osg hud. however before drawing the roi i press a toggle selection button which gets the stateset of the main camera as given below
>
>
> Code:
>
> osg::StateSet *stateSet = osg_viewer->getCamera()->getOrCreateStateSet();
>    osg::Point *pointState = (osg::Point*)stateSet->getAttribute(osg::StateAttribute::POINT);
>
>
>
>
> The 2d rectangle is drawn by mouse drag using the handler function. In the handler function the slave camera is created and added to the viewer as addSlave.
>
>
> Code:
>
> case(osgGA::GUIEventAdapter::PUSH):
> {
> camera_slaveBBox = createBBoxCamera();
> viewer->addSlave(camera_slaveBBox, false);
> }
>
>
>
>
> As the mouse the dragged the rectangle is drawn and all is good untill......On pressing the toggle selection button again in the first code "stateSet" is now returned NULL  :(
>
> Now if i comment
>
> Code:
>
> //commentviewer->addSlave(camera_slaveBBox, false)
>
>
>
>
> then stateSet indeed has some value. whats is the problem?
>
> [/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=38572#38572
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list