title: How do you enable a GL function in Qt3D with QML
body: <p>I am writing an application using Qt3D. Most of the 3D handling I have been doing has used QML not the C++ interface. I have created a QML effect that loads my shader programs similar to the PerVertex color effect QML that ships with Qt5.9.</p>
  
  <p>The problem I am having is I am trying to write a fragment shader and utilize <code>glBlendFunc(sfactor, dfactor)</code>. According to the OpenGL documentation, I need to set <code>glEnable(GL_BLEND)</code> and use <code>glBlendFunc</code>, but I don't know how to do that using QML. I can see how it is done on the C++ side of things, but as I am using QML Scene3D, that would take a great deal of rewriting to accomplish. Can anyone tell me how to enable OpenGL functions (like <code>GL_BLEND</code>) via Qt3D QML?</p>
  
  <p>As requested, the fragment shader: </p>
  
  <pre><code>#version 330 core
  
  // TODO: Replace with a struct
  uniform vec3 ka;            // Ambient reflectivity
  uniform vec3 kd;            // Diffuse reflectivity
  uniform vec3 ks;            // Specular reflectivity
  uniform float shininess;    // Specular shininess factor
  uniform float alpha;
  
  uniform vec3 eyePosition;
  
  in vec3 worldPosition;
  in vec3 worldNormal;
  in vec3 color;
  
  out vec4 fragColor;
  
  #pragma include light.inc.frag
  
  void main()
  {
      vec3 diffuseColor, specularColor;
      adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor);
      fragColor = vec4( ka * color + kd * color * diffuseColor + ks * color * specularColor, 1.0 );
  }
  </code></pre>
  
  <p>Here is also the Effect component:</p>
  
  <pre><code>import Qt3D.Core 2.0
  import Qt3D.Render 2.0
  
  Effect {
      id: root
  
  parameters: [
      Parameter { name: "k";         value: Qt.vector3d( 0.1, 0.1, 0.1 )    },
      Parameter { name: "kd";        value: Qt.vector3d( 0.7, 0.7, 0.7 )    },
      Parameter { name: "ks";        value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
      Parameter { name: "shininess"; value: 150.0                           }
  ]
  
  techniques: [
      Technique {
          graphicsApiFilter {
              api: GraphicsApiFilter.OpenGL
              profile: GraphicsApiFilter.CoreProfile
              majorVersion: 3
              minorVersion: 1
          }
  
          filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
  
          parameters: [
              Parameter { name: "light.position";  value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },
              Parameter { name: "light.intensity"; value: Qt.vector3d( 1.0, 1.0, 1.0 )      }
          ]
  
          renderPasses: [
              RenderPass {
                  filterKeys: [ FilterKey { name: "pass"; value: "forward" } ]
  
                  shaderProgram: ShaderProgram {
                      vertexShaderCode:   loadSource("qrc:/shaders/thermal.vert")
                      fragmentShaderCode: loadSource("qrc:/shaders/thermal.frag")
                  }
              }
          ]
      }
  ]
  }
  </code></pre>