Soo ... as some of you may have noticed, I started extending the "canvas development" article and added stuff from various places to document what we've been talking about regarding potential future additions.
Next, I got a message here from someone asking what would be involved in adding shader support to FG, so I took everything that I could find and added it to the wiki, too.
So I ended up writing some pseudo code - mostly copy&paste, based on some OSG tutorials and existing FG stuff to explain what needs to be done.
And I was going to add it to the wiki so that others can develop it further.
However, the funny thing is: I just tried it with the OSG greyscale fragment shader they're using in the tutorial - and well, it actually works:
Here's the same image with a fragment shader applied that turns every pixel red:
Here's a more sophisticated example:
It's less than 30 lines of code actually to run a fragment shader from $FG_ROOT/Shaders. I am currently applying the shader to all canvases via the canvas constructor.
The code took just a few minutes to put together - so it's really just a "prototype" currently, and would need to be modified to use our effects framework in SimGear obviously
So this would need to be extended:
If nobody else is interested in picking this up, I am going to generalize things a bit and use PropertyObject/PropertyBasedElement to generalize shader handling and push everything to a gitorious branch.
Otherwise, I'd hope that we could decide how to best proceed from here - supporting per-canvas shaders seems trivial and doable actually, integrating things with the effects framework is something I am probably not gonna do myself, because I am not familiar with it, and it would take me a while to get up to scratch with things (time being precious).
But I am sure that i4dnf, Zan or Stuart could help with the effects related side of things, while Tom could handle the Canvas integration ?
Also, I was hoping to do per-element rendering to sub-textures, so that we could support effects per canvas::element, rather than just per canvas
So, how do we want to proceed ?