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 

Outlining a node (Beginner)


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


Joined: 15 Dec 2017
Posts: 2

PostPosted: Fri Dec 15, 2017 12:48 pm    Post subject:
Outlining a node (Beginner)
Reply with quote

Hi,

I'm just starting out in OSG and have a basic robot arm model that I require an outline on a specific node. I have a nodeVisitor class which can find the node by name and I am stuck on outlining it.

Currently I am using this:

Code:
findNodeVisitor findBNode("BodyRotator");
osg::Node* bodyNode = new osg::Node;
g_pModel->accept(findBNode);
bodyNode = findBNode.getFirst();

osg::ref_ptr<osgFX::Outline> outline = new osgFX::Outline;
outline->setColor(osg::Vec4(1.0, 0.0, 0.0, 0.0));
outline->setWidth(100.0);
outline->addChild(bodyNode);
rootNode->addChild(outline);


But I only get a brief outline that flickers off after a second and only appears when rotating the robot arm. Does anyone have any pointers for getting this working?

Cheers,
Lex[/code]
Back to top
View user's profile Send private message
blobfish
Newbie


Joined: 14 Sep 2016
Posts: 9

PostPosted: Mon Dec 18, 2017 8:42 pm    Post subject:
Reply with quote

Hi,

You have a memory leak. You don't need to dynamically allocate for the Node*.

You find an existing node in the graph and put it under your outline, but you don't remove it from it's existing parent/s. did you intend to draw it more than once?

One of my favorite aspects of osg is the samples. Great resource for typical uses of objects.https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgoutline/osgoutline.cpp

Thank you!

Cheers,
tom
Back to top
View user's profile Send private message
lex
Newbie


Joined: 15 Dec 2017
Posts: 2

PostPosted: Mon Jan 15, 2018 11:24 am    Post subject:
Reply with quote

Hi,

I've had a look at my code and I've come up with this updated method of adding the outline, which works for a certain part of my robot, in this case the drawable of the UpperArm, however I'm still experiencing the same issue of flickering on and off when I try and use it.

Any help would be appreciated Very Happy

Code:
findNodeVisitor upperArm("UpperArmRotator");
wholeModel->accept(upperArm);

osgFX::Outline* upperArmOutline = new osgFX::Outline();
upperArmOutline->setWidth(100); //in an attempt to see it better
upperArmOutline->setColor(osg::Vec4(1, 1, 0, 1));

osg::Node* upperArmDrawable = upperArm.getFirst()->asGroup()->getChild(1);

upperArmOutline->addChild(upperArmDrawable);
upperArm.getFirst()->asGroup()->replaceChild(upperArm.getFirst()->asGroup()->getChild(1), upperArmOutline);



Thank you!

Cheers,
Lex
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 471
Location: France

PostPosted: Mon Jan 15, 2018 4:39 pm    Post subject:
Reply with quote

Hi Lex
I'm afraid the community knowledge around this feature began to fade with time...
Personnaly I avoid using old parts of osg (osgFX and osgParticle for ex) because a lot of techniques used in its features have evolved in a way that new hardware are not fitted anymore to them.

Perhaps asking the original contributor of OutLine directly could be your best bet

https://github.com/uhertlein

Cheers

lex wrote:
Hi,

I've had a look at my code and I've come up with this updated method of adding the outline, which works for a certain part of my robot, in this case the drawable of the UpperArm, however I'm still experiencing the same issue of flickering on and off when I try and use it.

Any help would be appreciated Very Happy

Code:
findNodeVisitor upperArm("UpperArmRotator");
wholeModel->accept(upperArm);

osgFX::Outline* upperArmOutline = new osgFX::Outline();
upperArmOutline->setWidth(100); //in an attempt to see it better
upperArmOutline->setColor(osg::Vec4(1, 1, 0, 1));

osg::Node* upperArmDrawable = upperArm.getFirst()->asGroup()->getChild(1);

upperArmOutline->addChild(upperArmDrawable);
upperArm.getFirst()->asGroup()->replaceChild(upperArm.getFirst()->asGroup()->getChild(1), upperArmOutline);



Thank you!

Cheers,
Lex
Back to top
View user's profile Send private message Visit poster's website
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 update node in view using cullcallback sirian_ye General 2 Wed Aug 29, 2018 11:40 pm View latest post
No new posts Leaking memory on node removal Tini General 1 Fri May 25, 2018 6:48 pm View latest post
No new posts Leaking memory on node removal Tini General 0 Fri May 25, 2018 6:39 pm View latest post
No new posts Leaking memory on node removal Tini General 0 Fri May 25, 2018 6:30 pm View latest post
No new posts Leaking memory on node removal Tini General 0 Fri May 25, 2018 6:27 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