Re: [osg-users] Custom Drawable GLSL

2012-09-05 Thread Jeremy Moles
On Tue, 2012-09-04 at 19:21 +0100, Robert Osfield wrote: Hi Jeremy, It should be possible to do a drawImplementation(..) { state.apply(stateSetOne); // do stuff state.apply(stateSetTwo); // do more stuff } I've settled on: drawImplementation() {

[osg-users] Custom Drawable GLSL

2012-09-04 Thread Jeremy Moles
I am creating a custom Drawable that needs to push a Fragment Shader into the current rendering state and then, after a single extension call, subsequently remove this shader from the state. I have some code I noodled through to make this work, but I feel like there is probably a better way. It

Re: [osg-users] Custom Drawable GLSL

2012-09-04 Thread Paul Martz
Doesn't a Drawable's state get applied prior to the call to Drawable::drawImplementation()? If so, you could just put the _program in your Drawable's StateSet? It's easy to verify that things are happening in the right order using a debugger with breakpoints set at your drawImplementation()

Re: [osg-users] Custom Drawable GLSL

2012-09-04 Thread Jeremy Moles
On Tue, 2012-09-04 at 11:05 -0600, Paul Martz wrote: Doesn't a Drawable's state get applied prior to the call to Drawable::drawImplementation()? If so, you could just put the _program in your Drawable's StateSet? I'm working on a nodekit for NV_path_rendering, which takes an as of yet

Re: [osg-users] Custom Drawable GLSL

2012-09-04 Thread Robert Osfield
Hi Jeremy, It should be possible to do a drawImplementation(..) { state.apply(stateSetOne); // do stuff state.apply(stateSetTwo); // do more stuff } I'm not 100% sure what will happen with the progress of draw traversal w.r.t how the drawable StateSet if any is applied and then later

Re: [osg-users] Custom Drawable GLSL

2012-09-04 Thread Jean-Sébastien Guay
Hi Jeremy, In the past I've done similar low-level 2-pass rendering in a Drawable, by doing as Robert suggests. Apply one stateset, draw, apply another, draw again (same or different geometry). A Program is just state, so you need to draw something in between setting different Programs.

Re: [osg-users] Custom Drawable GLSL

2012-09-04 Thread Jeremy Moles
On Tue, 2012-09-04 at 19:15 -0400, Jean-Sébastien Guay wrote: Hi Jeremy, In the past I've done similar low-level 2-pass rendering in a Drawable, by doing as Robert suggests. Apply one stateset, draw, apply another, draw again (same or different geometry). A Program is just state, so you