Trying to make raw OpenGL in a QtQuick application, it looks like QQuickWindow :: setClearBeforeRendering is not working?

I am using Qt 5.4, QtQuick 2.4.

Basically, I would like to provide raw OpenGL to an application written in QtQuick / QML, and I would like to do this when used QQmlApplicationEngine.

The main tutorial that I read is (apparently) fairly standard, found here .

However, this tutorial uses QQuickView, not QQmlApplicationEngineto load, the QML interface. If I changed the code to use QQmlApplicationEngine, GL rendering no longer works, and I really don't understand why.

Code in this GitHub promises repository for drawing the source OpenGL in a QtQuick application using QQmlApplicationEngine and even manages to keep this promise, but it does this by connecting to QQuickWindow::afterRendering(see line 79 of squircle.cpp). If this signal / slot connection is changed to connect to QQuickQindow::beforeRendering, part of the GL scene again looks unloaded. This IMO is the simplest example that reproduces the problem I am encountering (with the exception of some template hanging around).

QQuickWindow::clearBeforeRendering appears (correctly) for the false parameter (line 86 of the same file).

Did I miss something?

+4
source share
2 answers

Qt 5.4. , , - ApplicationWindow QML.

Main.qml...

ApplicationWindow
{
  id: mainWindow
  width: 800
  height: 600
  color: "black"

- , "" , . - setClearBeforeRendering (false) OpenGL QQuickItem beforeRendering().

, , glClear OpenGL, , .

!

, , - .

+3

Qt 5.4 Window.contentItem ApplicationWindow. , QQuickFramebufferObject, . GitHub.

, FBO__ , QtQuick Scenegraph OpenGL-under-Qml. setClearBeforeRendering(false) . , ApplicationWindow GUI. - ( flags ) , . QQuickFramebufferObject , , QQuickQindow::beforeRendering().

+2
source

Source: https://habr.com/ru/post/1569778/


All Articles