View previous topic :: View next topic |
|
Author |
Message |
brianh Newbie
Joined: 21 Dec 2017 Posts: 7
|
Posted: Wed Sep 05, 2018 4:29 pm Post 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::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 |
|
 |
Daniel Emminizer, Code... Guest
|
Posted: Wed Sep 05, 2018 4:37 pm Post subject: Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2 |
|
|
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: N);
auto texture = createTexture(aResourcesPath,
PointSpriteFileNames.at(aSpriteShape));
stateset->setTextureAttributeAndModes(0, texture,
osg::StateAttribute: N);
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: 12204
|
Posted: Wed Sep 05, 2018 4:46 pm Post subject: Textured PointSprites broken when upgrading from 3.5.6 to 3.6.2 |
|
|
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: N);
auto texture = createTexture(aResourcesPath, PointSpriteFileNames.at(aSpriteShape));
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute: N);
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 |
|
 |
|
|
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
|
|
Powered by phpBB © 2001, 2005 phpBB Group
|