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

Daniel Emminizer, Code 5773 dan.emminizer at nrl.navy.mil
Wed Sep 5 09:35:57 PDT 2018


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-bounces at lists.openscenegraph.org] On
> Behalf Of Brian Hutchison
> Sent: Wednesday, September 05, 2018 12:29 PM
> To: osg-users at 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<PointSpriteShapes, const std::string> 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<osg::PointSprite> 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<osg::Point> 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<osg::Texture2D>
> 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 at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list