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 

Getting a callback to update shaders?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Rowley, Marlin R
Guest





PostPosted: Tue Apr 10, 2018 12:49 pm    Post subject:
Getting a callback to update shaders?
Reply with quote

Hi,

I have a camera in the scene that I made. It has geometry attached to it to represent it. I also have a shader attached to some geometry in a scene where it uses the camera’s view/projection matrix. I’ve set up a callback (event driven) that when I move the camera with keyboard keys, it redraws the object correctly, but the shader on the geometry doesn’t update from the view/projection matrix change. What am I missing? I’ve been at this for 9hrs and can’t find any example that implements that I’m trying to do.

Thanks,

-M

----------------------------------------
Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)

------------------
Post generated by Mail2Forum
Back to top
Rowley, Marlin R
Guest





PostPosted: Tue Apr 10, 2018 3:00 pm    Post subject:
Getting a callback to update shaders?
Reply with quote

Nevermind. I figured out that I need to update the shader state variables on every refresh. I thought that an initial binding was all that was needed, but they have to be “Set” every frame.


----------------------------------------
Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)


From: osg-users [mailto:] On Behalf Of Rowley, Marlin R (US)
Sent: Tuesday, April 10, 2018 7:43 AM
To: OpenSceneGraph Users <>
Subject: EXTERNAL: Getting a callback to update shaders?



Hi,

I have a camera in the scene that I made. It has geometry attached to it to represent it. I also have a shader attached to some geometry in a scene where it uses the camera’s view/projection matrix. I’ve set up a callback (event driven) that when I move the camera with keyboard keys, it redraws the object correctly, but the shader on the geometry doesn’t update from the view/projection matrix change. What am I missing? I’ve been at this for 9hrs and can’t find any example that implements that I’m trying to do.

Thanks,

-M

----------------------------------------
Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11971

PostPosted: Tue Apr 10, 2018 4:57 pm    Post subject:
Getting a callback to update shaders?
Reply with quote

On 10 April 2018 at 16:55, Rowley, Marlin R < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:

Nevermind.  I figured out that I need to update the shader state variables on every refresh. I thought that an initial binding was all that was needed, but they have to be “Set” every frame.



It all depends what data you are needing to pass to the shader via uniforms.  The OSG provides standard replacements for the likes of gl_ModelViewMatrix automatically as osg_ModelViewMatrix etc. if you enable it via osg::State.  See the osgsimplegl3 example.


Robert. 


 

------------------
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 Shaders with multiple views using Vie... robertosfield General 5 Wed May 09, 2018 9:20 am View latest post
No new posts EXTERNAL: Re: Getting a callback to u... Rowley, Marlin R General 1 Tue Apr 10, 2018 6:58 pm View latest post
No new posts RTT and Shaders using vertex attribut... moet General 0 Fri Mar 16, 2018 10:59 pm View latest post
No new posts Shaders with multiple views, possible? arennuit General 9 Fri Jan 19, 2018 10:54 pm View latest post
No new posts Why are my shaders not being used? arennuit General 3 Fri Jan 19, 2018 6:45 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