Passing custom shader parameters with multiple views.

classic Classic list List threaded Threaded
2 messages Options
dmitriano dmitriano
Reply | Threaded
Open this post in threaded view
|

Passing custom shader parameters with multiple views.

This post was updated on .
I am working on an app that priviously had only one main window, and I had some degree of success adding multiple windows support to this app using CompositeViewer, and now the app works in the same way as osgearth_qt_windows sample does. Originally there was some custom shader working in app main window and the width and height of the main window were passed into this shader (as uniforms) in the main window resize event handler (this specific shader depends on view width and height). Now I am trying to figure out where should I move the code passing the shader parameters if I have multiple views? In other words, I need to access view's size and call some specific code before a view starts to draw. Is it possible to accomplish this task by overriding some virtual function like View::Draw, for example? And what is the proper way to get View's size?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Passing custom shader parameters with multiple views.

Dmitri,

Your question might be better suited to the OSG mailing list. But in general, you can use the StateSet on each View's osg::Camera to configure per-view state. Things like view-specific Uniforms or Defines would fall into this category.
Glenn Waldron / Pelican Mapping