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 

Scaling visitor not working as expected


 
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: Tue Jan 09, 2018 2:01 pm    Post subject:
Scaling visitor not working as expected
Reply with quote

Hi all,

I'm loading 3ds scenes as subnodes into my scene. The 3ds coordinates are in a different scale than my scene.
Usually I would solve this by a transform. But because of internal reasons I need the vertices being
in MY coordinate measure.
So I wrote a scaling visitor, that multiplies al vertices of geometries by a given factor.
That works perfectly fine when loading the 3ds scene:
        osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(path);
        ScaleVisitor sv(initialObjectScale * correctiveObjectScale);
        node->accept(sv);
        addChild(node);

Unfortunately when rescaling the object after being added as a child this doesn't work any more:
        osg::ref_ptr<osg::Node> node = getChild(0);
        ScaleVisitor sv(scaleChange);
       
node->accept(sv);

The 3ds scene doesn't change size on my screen.
The visitor calls:
        vertices->dirty();
        geom.dirtyBound();
But nothing happens. What am I missing? Deleting the 3ds scene and recreating it from scratch works OK but is very inefficient.

Thanks for any hint.

- Werner -

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
cbuchner1
Appreciator


Joined: 14 Mar 2012
Posts: 315

PostPosted: Tue Jan 09, 2018 5:00 pm    Post subject:
Scaling visitor not working as expected
Reply with quote

Are display lists active in your scene? if so, maybe a dirtyDisplayList() call might be required
on the affected drawables.



drawable->dirtyDisplayList()


As far as I know display lists are still the default in OSG, unless you explicitly disable them on

geometry objects (and possibly enable vertex buffer objects instead, for performance reasons)


the corresponding API calls on drawables would be

drawable->setUseDisplayList( false )

drawable->setUseVertexBufferObjects( true )


you could use a visitor right after loading the scene to switch off display lists and enabling
vertex buffer objects instead.


Christian






2018-01-09 14:58 GMT+01:00 Werner Modenbach < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>:
Quote:
Hi all,

I'm loading 3ds scenes as subnodes into my scene. The 3ds coordinates are in a different scale than my scene.
Usually I would solve this by a transform. But because of internal reasons I need the vertices being
in MY coordinate measure.
So I wrote a scaling visitor, that multiplies al vertices of geometries by a given factor.
That works perfectly fine when loading the 3ds scene:
        osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(path);
        ScaleVisitor sv(initialObjectScale * correctiveObjectScale);
        node->accept(sv);
        addChild(node);

Unfortunately when rescaling the object after being added as a child this doesn't work any more:
        osg::ref_ptr<osg::Node> node = getChild(0);
        ScaleVisitor sv(scaleChange);
       
node->accept(sv);

The 3ds scene doesn't change size on my screen.
The visitor calls:
        vertices->dirty();
        geom.dirtyBound();
But nothing happens. What am I missing? Deleting the 3ds scene and recreating it from scratch works OK but is very inefficient.

Thanks for any hint.

- Werner -


_______________________________________________
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
cbuchner1
Appreciator


Joined: 14 Mar 2012
Posts: 315

PostPosted: Tue Jan 09, 2018 5:01 pm    Post subject:
Scaling visitor not working as expected
Reply with quote

I just checked a recent osg::Drawable header file and it seems dirtyDisplayList() is deprecated

and has been replaced with dirtyGLObjects(). Relevant snippet follows:

#ifdef OSG_USE_DEPRECATED_API /** Deprecated, use dirtyGLObjects() instead. */ inline void dirtyDisplayList() { dirtyGLObjects(); } #endif
/** Force a recompile on next draw() of any OpenGL objects associated with this geoset.*/ virtual void dirtyGLObjects();





2018-01-09 17:57 GMT+01:00 Christian Buchner < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>:
Quote:

Are display lists active in your scene? if so, maybe a dirtyDisplayList() call might be required
on the affected drawables.



drawable->dirtyDisplayList()


As far as I know display lists are still the default in OSG, unless you explicitly disable them on

geometry objects (and possibly enable vertex buffer objects instead, for performance reasons)


the corresponding API calls on drawables would be

drawable->setUseDisplayList( false )

drawable->setUseVertexBufferObjects( true )


you could use a visitor right after loading the scene to switch off display lists and enabling
vertex buffer objects instead.


Christian






2018-01-09 14:58 GMT+01:00 Werner Modenbach < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>:


Quote:
Hi all,

I'm loading 3ds scenes as subnodes into my scene. The 3ds coordinates are in a different scale than my scene.
Usually I would solve this by a transform. But because of internal reasons I need the vertices being
in MY coordinate measure.
So I wrote a scaling visitor, that multiplies al vertices of geometries by a given factor.
That works perfectly fine when loading the 3ds scene:
        osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(path);
        ScaleVisitor sv(initialObjectScale * correctiveObjectScale);
        node->accept(sv);
        addChild(node);

Unfortunately when rescaling the object after being added as a child this doesn't work any more:
        osg::ref_ptr<osg::Node> node = getChild(0);
        ScaleVisitor sv(scaleChange);
       
node->accept(sv);

The 3ds scene doesn't change size on my screen.
The visitor calls:
        vertices->dirty();
        geom.dirtyBound();
But nothing happens. What am I missing? Deleting the 3ds scene and recreating it from scratch works OK but is very inefficient.

Thanks for any hint.

- Werner -




_______________________________________________
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
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 ViewerBase::setThreadingModel() not w... guyv Build system [build] 6 Thu Jul 12, 2018 3:22 pm View latest post
No new posts OSG vec3array size() function working... ak477 General 0 Fri Jul 06, 2018 5:57 pm View latest post
No new posts Viewer not working bakalarvae Build system [build] 4 Sun May 27, 2018 8:20 pm View latest post
No new posts Shader Program stops working after Ch... ceranco General 0 Mon May 21, 2018 3:09 pm View latest post
No new posts Bug in Cull Visitor Gedalia Pasternak General 6 Sat May 12, 2018 8:34 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