Consider the opengl under qml scene graph example http://doc.qt.io/qt-4.8/http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html

Everything works fine until i create a background rectangle of any color with full opacity.
I expect the squircle opengl widget to be shown with the rectangular component as a background but actually the background rectangle is drawn above the squircle and I am not able to see the opengl widget drawn using the shaders.

Actual code :
Qt Code:
  1. import QtQuick 2.0
  2. import OpenGLUnderQML 1.0
  3.  
  4. Item {
  5.  
  6. width: 320
  7. height: 480
  8.  
  9. //Actual widget which is drawn using opengl
  10. Squircle {
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 

Modified Code
Qt Code:
  1. import QtQuick 2.0
  2. import OpenGLUnderQML 1.0
  3.  
  4. Item {
  5.  
  6. width: 320
  7. height: 480
  8.  
  9. //Background rectangle which i expect to be shown below the opengl widget
  10. //But actually it gets drawn over the opengl widget
  11. //This is visible by reducing the opacity of the background rectnagle
  12. Rectangle {
  13. anchors.fill: parent
  14. color: "#ffff0000"
  15. }
  16.  
  17. Squircle {
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

Will there be any way to draw any qml components below the opengl widget drawn using QML ?