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 

Usage of osg::Uniform::Callback with osgPPU::ShaderAttribute ?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgPPU [osgPPU]
View previous topic :: View next topic  
Author Message
ParticlePeter
User


Joined: 14 Oct 2009
Posts: 60

PostPosted: Wed Nov 24, 2010 3:06 am    Post subject:
Usage of osg::Uniform::Callback with osgPPU::ShaderAttribute ?
Reply with quote

Hi,

I have an osg::Uniform::Callback which is working fine with osg::Programm, but I don't get it working with osg::ShaderAttribute.
The Uniform Value used in Constructor is correctly passed to my Shader, but the Values don't get update, as if the UpdateVisitor would not reach the Uniform.

osgPPU::ShaderAttribute * shaderAttribute = new osgPPU::ShaderAttribute() ;
osg::Uniform * uniform = new osg::Uniform( "Color" , osg::Vec4f( 1.0f , 0.0f , 0.0f , 1.0f ) ) ;
uniform -> setUpdateCallback( new UniformCallback ) ;
shaderAttribute -> add( uniform ) ;

UniformCallback is derived from osg::Uniform::Callback

While this code is working ( at another place )
osg::Uniform * uniform = new osg::Uniform( "Vector" , osg::Vec4f( 0.0f , 0.0f , 0.0f , 0.0f ) ) ;
uniform -> setUpdateCallback( new UniformCallback ) ;
stateSet -> addUniform( uniform ) ;

What do I miss ?


Thank you!

Cheers,
ParticlePeter
Back to top
View user's profile Send private message
art (Art Tevs)
Site Admin


Joined: 20 Dec 2008
Posts: 414
Location: Saarbr├╝cken, Germany

PostPosted: Fri Dec 03, 2010 11:14 am    Post subject:
Reply with quote

Hi Peter,

hmm, thats strange. Actually an update callback is always running over full osgPPU graph too. So it should reach node's stateset and hence also update a callback.

What happens if you specifiy just an update callback for an osgPPU unit. Unit's are derived from osg::Node so you could set an update callback on them. Please check then if the callback get called.

Cheers,
Art
Back to top
View user's profile Send private message Visit poster's website
ParticlePeter
User


Joined: 14 Oct 2009
Posts: 60

PostPosted: Thu Dec 09, 2010 11:02 pm    Post subject:
Reply with quote

Hi,

well, this code is properly updating my Uniform:
osg::Uniform * uniform = new osg::Uniform( "Vector" , osg::Vec4f( 0.0f , 0.0f , 0.0f , 0.0f ) ) ;
uniform -> setUpdateCallback( new UniformCallback ) ;
stateSet -> addUniform( uniform ) ;

So the update call back does reach the Uniform.
My guess is, that you cannot attach the UniformUpdateCallback to an osgPPU::ShaderAttribute, as this one is derived from osg::Programm, but the UniformUpdateCallback is meant to be attached to an osg::Uniform.

Cheers,
ParticlePeter
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgPPU [osgPPU] 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 uniform buffers for transform stack a... Gedalia Pasternak General 0 Mon Mar 13, 2017 3:17 pm View latest post
No new posts Glsl structs and osg::Uniform. How? Steal General 3 Thu Jan 26, 2017 12:04 pm View latest post
No new posts class osg::Callback and class osg::St... LiChi General 0 Fri Oct 14, 2016 6:37 pm View latest post
No new posts Collided nodes in callback matus General 4 Sat May 21, 2016 12:24 pm View latest post
No new posts Uniform set and callback Paradox General 2 Tue Apr 12, 2016 8:58 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