Re: [osg-users] Problems with OSG 3.2.0 (ok with 3.0.1)

2013-09-12 Thread David Liepelt
Hi,

I also encountered a problem after switching from OSG 3.0.1 to 3.2.0, regarding 
texturing using pixel buffer objects.

The application I’m working on draws a video texture which is set up as follows:

Code:

// create instances (m_* indicates that it is a class member)
m_videoTexture = new osg::Texture2D;
m_videoTexture-setDataVariance(osg::Object::DYNAMIC);

m_videoImageBuffer = new osg::Image;

m_videoImageBuffer-setImage(CAM_WIDTH,
CAM_HEIGHT,
1, GL_RGB,
GL_RGB, GL_UNSIGNED_BYTE, 
m_pointerToVideoImageData,
osg::Image::NO_DELETE);

// attach pbo
m_videoImageBuffer-setPixelBufferObject(new 
osg::PixelBufferObject(m_videoImageBuffer.get()));

// assign to texture
m_videoTexture-setImage(m_videoImageBuffer.get());



Each time a new video frame arrives the m_videoTexture is dirtied (-dirty()). 
This approach worked correctly under OSG 3.0.1.
Now under OSG 3.2.0 any geometry textured with the video texture remains black. 
Other objects in the scene are still textured correctly. Furthermore, after 
upgrading to 3.2.0 I’m getting now the following warning during start up:
Warning: detected OpenGL error 'invalid operation' at After Renderer::compile
So I think this has to do with my texturing problem.

Any suggestions how to fix this problem?

Cheers,
David

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56034#56034





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problems with OSG 3.2.0 (ok with 3.0.1)

2013-09-12 Thread Robert Osfield
Hi Ale,


On 28 August 2013 17:03, Ale Maro sash...@teletu.it 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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problems with OSG 3.2.0 (ok with 3.0.1)

2013-09-12 Thread Robert Osfield
Hi David,

The issue looks likely to be totally un-related to the bug in Ale's program
revealed by the bug fix to OSG-3.2.  There is chance that your own
application has this bug in the setup if you are applying your own
osg::Camera to a View(er) without setting up state correctly, but as this
is niche usage of the OSG it's likely the issue you have is unrelated.  It
may be worth double checking this though.

From your code snippet and warning report it's not possible to guess what
might be wrong. It could be a bug in your app, your particular build, the
OSG or OpenGL driver.  Which is the culprit isn't possible to say at this
point.

Could you create a small code example that reproduces the problem so that
others can recreate the problem?

Robert.


On 30 August 2013 12:03, David Liepelt david.liep...@gmail.com wrote:

 Hi,

 I also encountered a problem after switching from OSG 3.0.1 to 3.2.0,
 regarding texturing using pixel buffer objects.

 The application I’m working on draws a video texture which is set up as
 follows:

 Code:

 // create instances (m_* indicates that it is a class member)
 m_videoTexture = new osg::Texture2D;
 m_videoTexture-setDataVariance(osg::Object::DYNAMIC);

 m_videoImageBuffer = new osg::Image;

 m_videoImageBuffer-setImage(CAM_WIDTH,
 CAM_HEIGHT,
 1, GL_RGB,
 GL_RGB, GL_UNSIGNED_BYTE,
 m_pointerToVideoImageData,
 osg::Image::NO_DELETE);

 // attach pbo
 m_videoImageBuffer-setPixelBufferObject(new
 osg::PixelBufferObject(m_videoImageBuffer.get()));

 // assign to texture
 m_videoTexture-setImage(m_videoImageBuffer.get());



 Each time a new video frame arrives the m_videoTexture is dirtied
 (-dirty()). This approach worked correctly under OSG 3.0.1.
 Now under OSG 3.2.0 any geometry textured with the video texture remains
 black. Other objects in the scene are still textured correctly.
 Furthermore, after upgrading to 3.2.0 I’m getting now the following warning
 during start up:
 Warning: detected OpenGL error 'invalid operation' at After
 Renderer::compile
 So I think this has to do with my texturing problem.

 Any suggestions how to fix this problem?

 Cheers,
 David

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=56034#56034





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problems with OSG 3.2.0 (ok with 3.0.1)

2013-08-28 Thread Ale Maro
Hi,

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?

Thank you!

Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56012#56012





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org