<div dir="ltr"><div><div>Hi Andrey, thanks for your reply.<br><br></div>Still, can you try both tests on your Jolla?<br></div>The first shouldn't work, while the second does.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 10, 2015 at 10:32 AM, Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    sorry, not using emulator at all.<br>
    <br>
    <div>10.02.2015 14:28, Luca Donaggio пишет:<br>
    </div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Anybody is willing to try my test code and confirm
        or deny my finding?<br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Feb 6, 2015 at 2:12 PM, Luca
          Donaggio <span dir="ltr"><<a href="mailto:donaggio@gmail.com" target="_blank">donaggio@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">The following code works fine in Emulator,
              changing the gradient of the Rectangle correctly updates
              the nested ShaderEffectSource and it is reflected on the
              ShaderEffect which uses it as its texture:<br>
              <br>
              Page {<br>
                  id: page<br>
              <br>
                  SilicaFlickable {<br>
                      anchors.fill: parent<br>
              <br>
                      contentHeight: column.height<br>
              <br>
                      Column {<br>
                          id: column<br>
              <br>
                          anchors { top: parent.top; left: parent.left;
              right: parent.right; leftMargin: Theme.paddingLarge;
              rightMargin: Theme.paddingLarge; }<br>
                          spacing: Theme.paddingLarge<br>
              <br>
                          PageHeader {<br>
                              title: qsTr("ShaderEffect Test")<br>
                          }<br>
              <br>
                          Row {<br>
                              anchors.horizontalCenter:
              parent.horizontalCenter<br>
                              spacing: Theme.paddingLarge<br>
              <br>
                              Column {<br>
                                  spacing: Theme.paddingSmall<br>
              <br>
                                  Rectangle {<br>
                                      id: gradientSource<br>
              <br>
                                      property list<Gradient>
              gradients: [<br>
                                          Gradient {<br>
                                              GradientStop { position:
              0.0; color: "black"; }<br>
                                              GradientStop { position:
              1.0; color: "blue"; }<br>
                                          },<br>
              <br>
                                          Gradient {<br>
                                              GradientStop { position:
              0.0; color: "black"; }<br>
                                              GradientStop { position:
              1.0; color: "red"; }<br>
                                          }<br>
                                      ]<br>
              <br>
                                      width: 100<br>
                                      height: 100<br>
              <br>
                                      gradient: gradients[0]<br>
              <br>
                                      ShaderEffectSource {<br>
                                          id: gradientTexture<br>
              <br>
                                          anchors.fill: parent<br>
                                          sourceItem: gradientSource<br>
                                          hideSource: false<br>
                                          live: true<br>
                                      }<br>
                                  }<br>
              <br>
                                  Label {<br>
                                      font.pixelSize:
              Theme.fontSizeExtraSmall<br>
                                      wrapMode: Text.WordWrap<br>
                                      text:
              "Rectangle\nShaderEffectSource"<br>
                                  }<br>
                              }<br>
              <br>
                              Column {<br>
                                  spacing: Theme.paddingSmall<br>
              <br>
                                  ShaderEffect {<br>
                                      property variant source:
              gradientTexture<br>
              <br>
                                      width: 100<br>
                                      height: 100<br>
              <br>
                                      blending: false<br>
                                      cullMode:
              ShaderEffect.BackFaceCulling<br>
                                      fragmentShader: "<br>
                                          varying highp vec2
              qt_TexCoord0;<br>
                                          uniform lowp float qt_Opacity;<br>
                                          uniform sampler2D source;<br>
              <br>
                                          void main() {<br>
                                              gl_FragColor =
              texture2D(source, qt_TexCoord0) * qt_Opacity;<br>
                                          }"<br>
                                  }<br>
              <br>
                                  Label {<br>
                                      font.pixelSize:
              Theme.fontSizeExtraSmall<br>
                                      text: "ShaderEffect"<br>
                                  }<br>
                              }<br>
                          }<br>
              <br>
                          Button {<br>
                              anchors.horizontalCenter:
              parent.horizontalCenter<br>
                              text: "Blue gradient"<br>
              <br>
                              onClicked: gradientSource.gradient =
              gradientSource.gradients[0]<br>
                          }<br>
              <br>
                          Button {<br>
                              anchors.horizontalCenter:
              parent.horizontalCenter<br>
                              text: "Red gradient"<br>
              <br>
                              onClicked: gradientSource.gradient =
              gradientSource.gradients[1]<br>
                          }<br>
                      }<br>
                  }<br>
              }<br>
              <br clear="all">
              <div>It doesn't work on device though (changing
                Reactangle's gradient doesn't update the
                ShaderEffectSource).<br>
                <br>
              </div>
              <div>Un-nesting the ShaderEffectSource from its source
                item (the Rectangle) works fine both on emulator and on
                device:<br>
                <br>
                Page {<br>
                    id: page<br>
                <br>
                    SilicaFlickable {<br>
                        anchors.fill: parent<br>
                <br>
                        contentHeight: column.height<br>
                <br>
                        Column {<br>
                            id: column<br>
                <br>
                            anchors { top: parent.top; left:
                parent.left; right: parent.right; leftMargin:
                Theme.paddingLarge; rightMargin: Theme.paddingLarge; }<br>
                            spacing: Theme.paddingLarge<br>
                <br>
                            PageHeader {<br>
                                title: qsTr("ShaderEffect Test")<br>
                            }<br>
                <br>
                            Row {<br>
                                anchors.horizontalCenter:
                parent.horizontalCenter<br>
                                spacing: Theme.paddingLarge<br>
                <br>
                                Column {<br>
                                    spacing: Theme.paddingSmall<br>
                <br>
                                    Rectangle {<br>
                                        id: gradientSource<br>
                <br>
                                        property list<Gradient>
                gradients: [<br>
                                            Gradient {<br>
                                                GradientStop { position:
                0.0; color: "black"; }<br>
                                                GradientStop { position:
                1.0; color: "blue"; }<br>
                                            },<br>
                <br>
                                            Gradient {<br>
                                                GradientStop { position:
                0.0; color: "black"; }<br>
                                                GradientStop { position:
                1.0; color: "red"; }<br>
                                            }<br>
                                        ]<br>
                <br>
                                        width: 100<br>
                                        height: 100<br>
                <br>
                                        gradient: gradients[0]<br>
                                    }<br>
                <br>
                                    Label {<br>
                                        font.pixelSize:
                Theme.fontSizeExtraSmall<br>
                                        text: "Rectangle"<br>
                                    }<br>
                                }<br>
                <br>
                                Column {<br>
                                    spacing: Theme.paddingSmall<br>
                <br>
                                    ShaderEffectSource {<br>
                                        id: gradientTexture<br>
                <br>
                                        width: 100<br>
                                        height: 100<br>
                                        sourceItem: gradientSource<br>
                                        hideSource: false<br>
                                        live: true<br>
                                    }<br>
                <br>
                                    Label {<br>
                                        font.pixelSize:
                Theme.fontSizeExtraSmall<br>
                                        text: "ShaderEffectSource"<br>
                                    }<br>
                                }<br>
                <br>
                                Column {<br>
                                    spacing: Theme.paddingSmall<br>
                <br>
                                    ShaderEffect {<br>
                                        property variant source:
                gradientTexture<br>
                <br>
                                        width: 100<br>
                                        height: 100<br>
                <br>
                                        blending: false<br>
                                        cullMode:
                ShaderEffect.BackFaceCulling<br>
                                        fragmentShader: "<br>
                                            varying highp vec2
                qt_TexCoord0;<br>
                                            uniform lowp float
                qt_Opacity;<br>
                                            uniform sampler2D source;<br>
                <br>
                                            void main() {<br>
                                                gl_FragColor =
                texture2D(source, qt_TexCoord0) * qt_Opacity;<br>
                                            }"<br>
                                    }<br>
                <br>
                                    Label {<br>
                                        font.pixelSize:
                Theme.fontSizeExtraSmall<br>
                                        text: "ShaderEffect"<br>
                                    }<br>
                                }<br>
                            }<br>
                <br>
                            Button {<br>
                                anchors.horizontalCenter:
                parent.horizontalCenter<br>
                                text: "Blue gradient"<br>
                <br>
                                onClicked: gradientSource.gradient =
                gradientSource.gradients[0]<br>
                            }<br>
                <br>
                            Button {<br>
                                anchors.horizontalCenter:
                parent.horizontalCenter<br>
                                text: "Red gradient"<br>
                <br>
                                onClicked: gradientSource.gradient =
                gradientSource.gradients[1]<br>
                            }<br>
                        }<br>
                    }<br>
                }<br>
                <br>
              </div>
              <div>Is it a bug?<span><font color="#888888"><br>
                  </font></span></div>
              <span><font color="#888888">
                  <div><br>
                    -- <br>
                    <div>Luca Donaggio</div>
                  </div>
                </font></span></div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        <div>Luca Donaggio</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Luca Donaggio</div>
</div>