[Interest] How to use serveral textures in a QSGSimpleMaterialShader

Martin Ertl qsmokeonthewater at gmail.com
Fri Jul 25 11:13:16 CEST 2014


Yes you're right, I'm using OpenGL ES 2 and I'm trying to create my own
component with custom shaders. At the moment there are still some problems
(my component seems to destroy the whole scene) but I think I did a mistake
somewhere. I should compare with the qquickimageparticle
<https://qt.gitorious.org/qt/qtdeclarative/source/4f69825c5bfd93b63f890a8188ece93af1283f1f:src/particles/qquickimageparticle.cpp#L207-297>
what's the difference.

Have a nice weekend,
Martin


2014-07-24 11:51 GMT+02:00 Till Oliver Knoll <till.oliver.knoll at gmail.com>:

> Am 24.07.2014 um 11:25 schrieb Martin Ertl <qsmokeonthewater at gmail.com>:
>
> ...
>
> -> define 'which texture unit a given "uniform sampler2D tex" refers to'
> by calling
>         program()->setUniformValue("uTex0", 0);
>         program()->setUniformValue("uTex1", 1);
>         ...
>
>
> Or use the "layout syntax" in the shader itself, so you can skip setting
> the "value" ("texture unit selector") of the uniforms (like you do above),
> like so:
>
> layout (binding = 0) uniform sampler2D foo;
>> layout (binding = 1) uniform sampler2D bar;
>> etc.
>>
>
> Works at least with recent OpenGL versions (and off course only if you
> write the shaders yourself ;)).
>
> But by now I realise that the "SG" prefix probably stands for "Scene
> Graph" (which you are probably extending with your own objects), so you're
> with OpenGL ES 2 I guess (which probably won't digest above shader "layout"
> syntax).
>
> Cheers,
>   Oliver
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140725/2f9c9421/attachment.html>


More information about the Interest mailing list