OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
brianh
Newbie


Joined: 21 Dec 2017
Posts: 7

PostPosted: Wed Sep 05, 2018 4:29 pm    Post subject:
Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2
Reply with quote

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]
Back to top
View user's profile Send private message
Daniel Emminizer, Code...
Guest





PostPosted: Wed Sep 05, 2018 4:37 pm    Post subject:
Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2
Reply with quote

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



Quote:
-----Original Message-----
From: osg-users [mailto:] On
Behalf Of Brian Hutchison
Sent: Wednesday, September 05, 2018 12:29 PM
To:
Subject: 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:ShockedN);

auto texture = createTexture(aResourcesPath,
PointSpriteFileNames.at(aSpriteShape));
stateset->setTextureAttributeAndModes(0, texture,
osg::StateAttribute:ShockedN);

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








------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12149

PostPosted: Wed Sep 05, 2018 4:46 pm    Post subject:
Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2
Reply with quote

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:
Quote:

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:ShockedN);

auto texture = createTexture(aResourcesPath, PointSpriteFileNames.at(aSpriteShape));
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute:ShockedN);

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Trackball Manipulation Broken? ehensens General 2 Tue May 08, 2018 9:44 pm View latest post
No new posts Straight lines are broken during rota... adrianj General 6 Fri Jan 19, 2018 1:19 am View latest post
No new posts Broken link arennuit General 2 Mon Aug 14, 2017 10:10 am View latest post
No new posts issue with 3ds model after upgrading ... filnet General 5 Thu Feb 09, 2017 1:27 pm View latest post
No new posts Rendering Textured Quad no longer wor... mille25 General 1 Mon Sep 12, 2016 9:50 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP