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 

Strange behaviour - no explanation


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


Joined: 06 Feb 2013
Posts: 103

PostPosted: Wed Jan 24, 2018 5:08 pm    Post subject:
Strange behaviour - no explanation
Reply with quote

Hi all,

I import a 3DS model and after import it shows me a flat structure of geodes:

Final OSG node structure looks like this:
Group
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
         Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry   

I do a pick with a LineSegmentIntersector.
The Interesections array contains 1 hit.
It is a geometry and has 1 parent - the geode.
I want this geometry to show in line mode.
geometry->getOrCreateStateSet()->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE));

But many geometries show up in line mode.
I wrote a check NodeVisitor and this visitor finds many geometries being set to LineMode.
I wrote another visitor which explicitely disables linemode on all geometries after loading of the model:
geometry->getOrCreateStateSet()->setMode(osg::StateAttribute::POLYGONMODE, osg::StateAttribute::OFF);
I already spent many hours on that but I'm running out of ideas.

Any hint from someone in the list?

Many thanks in advance

- Werner -

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
errno (Lionel Lagarde)
User


Joined: 10 Mar 2009
Posts: 58
Location: Toulouse, France

PostPosted: Thu Jan 25, 2018 7:52 am    Post subject:
Strange behaviour - no explanation
Reply with quote

Hi,

The geometry state set is probably shared among several nodes.
You should clone the state set before setting the polygon mode:
if (geometry->getStateSet() && geometry->getStateSet()->getParents().size() > 1)
{
   geometry->setStateSet(new osg::StateSet(*geometry->getStateSet()));
}

geometry->getOrCreateStateSet()->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE));

On 24/01/2018 18:04, Werner Modenbach wrote:

Quote:
Hi all,

I import a 3DS model and after import it shows me a flat structure of geodes:

Final OSG node structure looks like this:
Group
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
         Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
    Geode
        Geometry
        Geometry
    Geode
        Geometry
    Geode
        Geometry   

I do a pick with a LineSegmentIntersector.
The Interesections array contains 1 hit.
It is a geometry and has 1 parent - the geode.
I want this geometry to show in line mode.
geometry->getOrCreateStateSet()->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE));

But many geometries show up in line mode.
I wrote a check NodeVisitor and this visitor finds many geometries being set to LineMode.
I wrote another visitor which explicitely disables linemode on all geometries after loading of the model:
geometry->getOrCreateStateSet()->setMode(osg::StateAttribute::POLYGONMODE, osg::StateAttribute::OFF);
I already spent many hours on that but I'm running out of ideas.

Any hint from someone in the list?

Many thanks in advance

- Werner -






Quote:
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message Send e-mail
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 strange behaviour with osgText::Text christoph General 0 Wed Jul 18, 2018 12:06 pm View latest post
No new posts Strange behaviour on GBufferCamera wi... wernerM General 5 Wed Jun 27, 2018 12:53 pm View latest post
No new posts Strange limitation to 60fps kragnfroll General 3 Mon Jan 30, 2017 10:31 am View latest post
No new posts Strange problem with QT, OSG and osgd... mille25 General 8 Tue Aug 09, 2016 10:41 am View latest post
No new posts picking behaviour using osgViewer::Vi... swanggt1 General 3 Fri May 06, 2016 8:54 pm 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