Hi Ale,

On 28 August 2013 17:03, Ale Maro <[email protected]> wrote:

> I solved in an unespected way.
> When I setup a the view camera I did the following:
>
> camera = new osg::Camera;
> ... my camera settings
>
> Now I get the camera pointer from the osg::View
>
> camera = view->getCamera();
> ... my camera settings
>
> So it seems that, in OSG 3.2.0, camera settings in the default constructor
> are not correct and are different from default camera settings on osg::View.
> Can you confirm?
>

It's actually OSG-3.2.0 that is correct, and OSG-3.0.x and previous
versions were broken, but broken in way that hide the fact that a View's
master Camera's StateSet was empty() in your case.

What was happening is the internally osgUtil::SceneView that is used
internally by osgViewer to manage the rendering backend was overriding the
View's Camera's StateSet with it's own values and clearing the ones set by
the View's Camera.  This normally didn't produce problems as SceneView
didn't set useful defaults for most common usage models, but if the user
ever wanted to apply their own StateSet settings view the View's Camera
these could be lost resulting in bugs.

The implemention in OSG-3.2.0 now doesn't override the View's Camera's
StateSet, it uses it directly to set up OpenGL state.  If the View's
Camera's StateSet is empty() then it'll do nothing - and in your case where
you apply a default constructed Camera to View it'll be have an empty
StateSet.  What result you are getting is *exactly* the result you are
asking the OSG to provide for you.  It might not what you want, but in
previous OSG versions there was a bug so hid this problem.

If however you use the View's master Camera that is attached by default
then it automatically calls stateset->setGlobalDefaults(); for you and it's
this provides the same settings the SceneView was forcing on all usages, so
you'll get the same behaviour as in OSG-3.0.x and before.  Alternatively
you can just create your own Camera but you'll need to add the line:

   camera->getOrCreateStateSet()->setGlobalDefaults();


Again, I will re-interate this change in behaviour is a bug fix that is
reveals a bug in the way you were setting up the OSG, so it's a case of bug
hiding a bug, when you remove the bug a bug appears seemingly out of
nowhere, but it's been sitting their latent in your application.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to