I am using QQuickFramebufferObject in QML to draw OpenGL code. I've found a couple ways to do OpenGL with QML, one of which (in Qt's Squircle example) is to draw all OpenGL either below everything or above everything, but I'm using the QQuickFramebufferObject method because I need regular QML objects both above and below the OpenGL-drawn object.
All the OpenGL code works fine. The background of the QQuickFramebufferObject needs to be transparent so that the QML objects underneath can be seen. (My QQuickFramebufferObject draws an abstract shape.) However, QQuickFramebufferObject seems to block out its rectangle on the screen and not show anything underneath. I have tried
glClearColor( 0.0, 0.0, 0.0, 0.0f );
glClear( GL_COLOR_BUFFER_BIT );
so that the background is transparent, but instead I just get a white rectangle. Even if I skip calling the FBO's render altogether, it still draws over everything, so I think it's something outside the OpenGL code and how QML handles the FBO.
What I want:
What I get:
I figured it out, it was a mistake not with the FBO, but the Rectangle holding it. I never set its color, since I'm only using it as a holder for other objects, which seems to be by default white, not transparent. I changed it to be color: "transparent" and now all is well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With