[Interest] Set shader on QSGFlatColorMaterial?
markg85 at gmail.com
Wed Jun 12 10:11:35 CEST 2013
On Wed, Jun 12, 2013 at 9:35 AM, Sletta Gunnar <Gunnar.Sletta at digia.com> wrote:
> On Jun 9, 2013, at 12:59 AM, Mark <markg85 at gmail.com> wrote:
>> Yet another scene graph related question :)
>> I have to say, the documentation in the scene graph department could
>> really use some more docs and advanced examples! The code leaves a lot
>> of guess work and there isn't much to find since this tech is quite
> I know, I'm adding stuff as time permits :)
>> Anyhow, I want to apply a shader to my flat material.
>> QSGFlatColorMaterial has a createShader() method that return a
>> QSGMaterialShader, but then what?
> You set the material on the geometry node and the rest happens internally.
>> Also, how can i set multiple shaders on one material?
> You don't. You can use two different geometry nodes which share the same QSGGeometry but have different materials (see the code in the example I posted in the other thread). Or you can have one QSGGeometryNode which reimplements QSGNode::preprocess() to switch the material at runtime just before it is drawn.
>> since the flat
>> material i'm talking about now needs two. One for antialiasing
>> (playing with that ) and one for drawing a shadow.
> This is algorithm is applying a post-filtering effect on the entire scene after it is rendered. This is not something you do with just nodes in scenegraph.
> If you want to apply this for the whole window you should use QQuickWindow::beforeRendering to redirect the QQuickWindow to an FBO using QQuickWindow::setRenderTarget(). Then you can use QQuickWindow::afterRendering() to apply the FXAA filtering to that FBO as you draw it to the screen.
> If you want to do this inside QML, you can also do that using a ShaderEffectsouce and ShaderEffect on the graph element. Then the ShaderEffectSource will do the rendering to the FBO and the ShaderEffect will apply the post processing.
> But I do suspect that text and single-pixel horizontal/vertical lines will look rather ugly afterwards :)
>>  http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf
>> Interest mailing list
>> Interest at qt-project.org
Awesome, i think i'm just going to stick with your new example code
and continue from there on.
That seems to the way to go anyway. Your example just made it a lot
more accessible for me :)
More information about the Interest