Re: [osg-users] Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2

2018-09-05 Thread Robert Osfield
HI Brian,

I am not aware of any issues with textured point sprites in 3.6.

If the rendering flickers between states as you move the eye point
then this is an indication that some state hasn't been consistently
set up in your scene graph so that subgraph that is flickering is
inheriting state randomly from other parts of the scene.  An undefined
colour array or texture coord array in an osg::Geometry would cause
this type of isse.

With some much application specific code in your code snippets there
really is just too many unkowns for us to be able to guess what may be
wrong.

The best way for us to help would be if you can create a small example
that illustrates the problem.  If there is a bug in your code then
just trying to recreate the code might help you spot this.  If there
is an actual bug on the OSG side then this example could be used as a
unit test that we can use to reproduce the bug and help with the debug
process.

Cheers,
Robert.


Robert.
On Wed, 5 Sep 2018 at 17:28, Brian Hutchison  wrote:
>
> Hi,
>
> We recently upgraded OSG from 3.5.6 to 3.6.2 and our textured PointSprites 
> stopped working.
>
> In a debug build they work fine but in a release build they do not display 
> or, if they do, they display using a translucent version of the non-textured 
> points which flash on and off as we navigate the scene.
>
> The code is based on the osgpointsprite example - which we cannot get to fail.
>
> The code is used by several features all of which have the bug.  If we strip 
> it down to just one feature using this code then it still has the bug.  If we 
> strip out the textures then default Points work fine on all features.
>
> Using hard-coded textures instead of loading them from files does not help.
>
> We have tried just about everything we can think of and are about to switch 
> to a combination of non-textured points, billboards & simple geometries as a 
> workaround.
>
>
> Code:
>
> addPointSprite(mModel.base().dataPaths.resourcesPath(),
>PointSpriteShapes::Diamond,
>NodePointSizeLarge,
>NodePointSizeSmall,
>NodePointSizeLarge,
>mNodesGeometry);
>
> const std::map PointSpriteFileNames = {
> {PointSpriteShapes::Circle, "Circle.png"},
> {PointSpriteShapes::Diamond, "Diamond.png"},
> {PointSpriteShapes::Square, "Square.png"},
> {PointSpriteShapes::MarkerRouteStart, "MarkerRouteStart.png"},
> {PointSpriteShapes::MarkerRouteBroken, "MarkerRouteBroken.png"},
> {PointSpriteShapes::MarkerRouteEnd, "MarkerRouteEnd.png"},
> };
>
> void
> addPointSprite(const std::string & aResourcesPath,
>PointSpriteShapes   aSpriteShape,
>float   aStartingSize,
>float   aMinSize,
>float   aMaxSize,
>osg::Node * aNode)
> {
> Expects(PointSpriteFileNames.find(aSpriteShape) != 
> PointSpriteFileNames.end());
>
> auto stateset = aNode->getOrCreateStateSet();
>
> osg::ref_ptr sprite = new osg::PointSprite();
> sprite->setCoordOriginMode(osg::PointSprite::LOWER_LEFT);
> stateset->setTextureAttributeAndModes(0, sprite, osg::StateAttribute::ON);
>
> auto texture = createTexture(aResourcesPath, 
> PointSpriteFileNames.at(aSpriteShape));
> stateset->setTextureAttributeAndModes(0, texture, 
> osg::StateAttribute::ON);
>
> osg::ref_ptr point = new osg::Point();
> point->setSize(aStartingSize);
> point->setMinSize(aMinSize);
> point->setMaxSize(aMaxSize);
> if (aMaxSize > aMinSize)
> {
> point->setDistanceAttenuation(osg::Vec3{1.0f, 0.001f, 0.0f});
> }
> stateset->setAttribute(point);
> }
>
> inline osg::ref_ptr
> createTexture(const std::string & aResourcesPath, const std::string & 
> aImageName)
> {
> const auto imagePath = aResourcesPath + "/images/" + aImageName;
> return new osg::Texture2D(osgDB::readRefImageFile(imagePath));
> }
>
>
>
>
> Are you aware of any issues with textures point sprites in 3.5.6, or can you 
> see what we are doing wrong?
>
> Thanks,
>
> Brian[/code]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74665#74665
>
>
>
>
>
> ___
> 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] Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2

2018-09-05 Thread Daniel Emminizer, Code 5773
Hi Brian,

This might be fixed by:

https://github.com/openscenegraph/OpenSceneGraph/commit/e8b56c5c9735e70

It's documented on the mailing list thread:

http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2018-August/008829.html

- Dan



> -Original Message-
> From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On
> Behalf Of Brian Hutchison
> Sent: Wednesday, September 05, 2018 12:29 PM
> To: osg-users@lists.openscenegraph.org
> Subject: [osg-users] Textured PointSprites broken when upgrading from
> 3.5.6 to 3.6.2
> 
> Hi,
> 
> We recently upgraded OSG from 3.5.6 to 3.6.2 and our textured PointSprites
> stopped working.
> 
> In a debug build they work fine but in a release build they do not display 
> or, if
> they do, they display using a translucent version of the non-textured points
> which flash on and off as we navigate the scene.
> 
> The code is based on the osgpointsprite example - which we cannot get to
> fail.
> 
> The code is used by several features all of which have the bug.  If we strip 
> it
> down to just one feature using this code then it still has the bug.  If we 
> strip
> out the textures then default Points work fine on all features.
> 
> Using hard-coded textures instead of loading them from files does not help.
> 
> We have tried just about everything we can think of and are about to switch
> to a combination of non-textured points, billboards & simple geometries as a
> workaround.
> 
> 
> Code:
> 
> addPointSprite(mModel.base().dataPaths.resourcesPath(),
>PointSpriteShapes::Diamond,
>NodePointSizeLarge,
>NodePointSizeSmall,
>NodePointSizeLarge,
>mNodesGeometry);
> 
> const std::map PointSpriteFileNames =
> {
> {PointSpriteShapes::Circle, "Circle.png"},
> {PointSpriteShapes::Diamond, "Diamond.png"},
> {PointSpriteShapes::Square, "Square.png"},
> {PointSpriteShapes::MarkerRouteStart, "MarkerRouteStart.png"},
> {PointSpriteShapes::MarkerRouteBroken, "MarkerRouteBroken.png"},
> {PointSpriteShapes::MarkerRouteEnd, "MarkerRouteEnd.png"},
> };
> 
> void
> addPointSprite(const std::string & aResourcesPath,
>PointSpriteShapes   aSpriteShape,
>float   aStartingSize,
>float   aMinSize,
>float   aMaxSize,
>osg::Node * aNode)
> {
> Expects(PointSpriteFileNames.find(aSpriteShape) !=
> PointSpriteFileNames.end());
> 
> auto stateset = aNode->getOrCreateStateSet();
> 
> osg::ref_ptr sprite = new osg::PointSprite();
> sprite->setCoordOriginMode(osg::PointSprite::LOWER_LEFT);
> stateset->setTextureAttributeAndModes(0, sprite,
> osg::StateAttribute::ON);
> 
> auto texture = createTexture(aResourcesPath,
> PointSpriteFileNames.at(aSpriteShape));
> stateset->setTextureAttributeAndModes(0, texture,
> osg::StateAttribute::ON);
> 
> osg::ref_ptr point = new osg::Point();
> point->setSize(aStartingSize);
> point->setMinSize(aMinSize);
> point->setMaxSize(aMaxSize);
> if (aMaxSize > aMinSize)
> {
> point->setDistanceAttenuation(osg::Vec3{1.0f, 0.001f, 0.0f});
> }
> stateset->setAttribute(point);
> }
> 
> inline osg::ref_ptr
> createTexture(const std::string & aResourcesPath, const std::string &
> aImageName)
> {
> const auto imagePath = aResourcesPath + "/images/" + aImageName;
> return new osg::Texture2D(osgDB::readRefImageFile(imagePath));
> }
> 
> 
> 
> 
> Are you aware of any issues with textures point sprites in 3.5.6, or can you
> see what we are doing wrong?
> 
> Thanks,
> 
> Brian[/code]
> 
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74665#74665
> 
> 
> 
> 
> 
> ___
> 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