[Interest] How to use serveral textures in a QSGSimpleMaterialShader
Martin Ertl
qsmokeonthewater at gmail.com
Wed Jul 23 19:06:49 CEST 2014
Hello,
I'm trying to apply several textures to a geometry (stored as
QSGGeometry::TexturedPoint2D[])
using a QSGSimpleMaterialShader.
I had a look at the "noisynode" example
(http://qt-project.org/doc/qt-5/qtquick-scenegraph-graph-noisynode-cpp.html)
where similiar things are done.
But the difference is that I don't know how to handle several textures.
The example uses a "uniform sampler2D texture;" in its fragment shader and
calls
"QSGTexture::bind()" during "updateState()".
This works for me as long I just have one texture.
I tried to "bind()" a second texture just after the first one and
added a second "uniform sampler2D anotherTexture;" to the fragment shader
Result:
Both "uniform sampler2D" variables in the fragment shader
seem to contain the same texture.
Question:
Where is my mistake?
Does the call of "bind()" on the second texture overwrite the "bind()" from
the first texture?
I also had a look at the "QtQuick3D" which I know is able to handle several
textures. I found void "ShaderProgramEffect::setUniform" but it seems to me
that it's using a QGLPainter which has a method "glActiveTexture()"
(
https://qt.gitorious.org/qt-labs/qt3d/source/93ef35ac51ca54f1e30ae0971e8bd8bda0939c27:src/imports/threed/shaderprogram.cpp#L531
)
Is there a similiar "activateTexture" call for a QSGSimpleMaterialShader?
Thank you and best regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140723/f480b28c/attachment.html>
More information about the Interest
mailing list