Re: [Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-28 Thread Martin Ertl
Hi, maybe someone is interested why the whole scene was broken with the custom component. It seems to be important that in the "updateState()" method the "GL_TEXTURE0" is activated as last texture (like contained in the image particle code). Best regards, Martin 2014-07-25 11:13 GMT+02:00 Mart

Re: [Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-25 Thread Martin Ertl
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

Re: [Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-24 Thread Till Oliver Knoll
Am 24.07.2014 um 11:25 schrieb Martin Ertl : > ... > -> 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 it

Re: [Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-24 Thread Martin Ertl
Hello Till, thank you for your hints. That gave me some input for further search and I found this nice little piece of code which shows nearly everything I'd like to do :-) https://qt.gitorious.org/qt/qtdeclarative/source/4f69825c5bfd93b63f890a8188ece93af1283f1f:src/particles/qquickimageparticle.c

Re: [Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-24 Thread Till Oliver Knoll
Am 24.07.2014 um 09:28 schrieb Till Oliver Knoll : > ... > In recent (OpenGL >= 4.1?) shader versions there is also a "layout" (or > "location") qualifier, so you can save the call to glUniform1i - but the > exact syntax escapes me right now. >From the "OpenGL SuperBible": layout (binding = 0)

Re: [Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-24 Thread Till Oliver Knoll
Am 23.07.2014 um 19:06 schrieb Martin Ertl : > ... > > Question: > Where is my mistake? > Does the call of "bind()" on the second texture overwrite the "bind()" from > the first texture? Yes :) > ... which has a method "glActiveTexture()" This. I can only speak for "raw OpenGL" right now, but

[Interest] How to use serveral textures in a QSGSimpleMaterialShader

2014-07-23 Thread Martin Ertl
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 diffe