diff options
Diffstat (limited to 'examples/quick')
-rw-r--r-- | examples/quick/scenegraph/.prev_CMakeLists.txt | 4 | ||||
-rw-r--r-- | examples/quick/scenegraph/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/CMakeLists.txt (renamed from examples/quick/scenegraph/textureinthread/CMakeLists.txt) | 24 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/doc/images/opengltextureinthread-example.jpg (renamed from examples/quick/scenegraph/textureinthread/doc/images/textureinthread-example.jpg) | bin | 33269 -> 33269 bytes | |||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/doc/src/opengltextureinthread.qdoc (renamed from examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc) | 4 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/error.qml (renamed from examples/quick/scenegraph/textureinthread/error.qml) | 0 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/main.cpp (renamed from examples/quick/scenegraph/textureinthread/main.cpp) | 3 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/main.qml (renamed from examples/quick/scenegraph/textureinthread/main.qml) | 30 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/opengltextureinthread.pro (renamed from examples/quick/scenegraph/textureinthread/textureinthread.pro) | 2 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/textureinthread.qrc (renamed from examples/quick/scenegraph/textureinthread/textureinthread.qrc) | 0 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp (renamed from examples/quick/scenegraph/textureinthread/threadrenderer.cpp) | 5 | ||||
-rw-r--r-- | examples/quick/scenegraph/opengltextureinthread/threadrenderer.h (renamed from examples/quick/scenegraph/textureinthread/threadrenderer.h) | 0 | ||||
-rw-r--r-- | examples/quick/scenegraph/scenegraph.pro | 2 |
13 files changed, 28 insertions, 48 deletions
diff --git a/examples/quick/scenegraph/.prev_CMakeLists.txt b/examples/quick/scenegraph/.prev_CMakeLists.txt index cf72c90b8d..4807706a43 100644 --- a/examples/quick/scenegraph/.prev_CMakeLists.txt +++ b/examples/quick/scenegraph/.prev_CMakeLists.txt @@ -5,11 +5,9 @@ add_subdirectory(rendernode) add_subdirectory(threadedanimation) if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) add_subdirectory(graph) - add_subdirectory(simplematerial) - add_subdirectory(sgengine) add_subdirectory(fboitem) add_subdirectory(openglunderqml) - add_subdirectory(textureinthread) + add_subdirectory(opengltextureinthread) add_subdirectory(twotextureproviders) endif() if(IOS OR MACOS) diff --git a/examples/quick/scenegraph/CMakeLists.txt b/examples/quick/scenegraph/CMakeLists.txt index 2a5db7da54..f899f1d234 100644 --- a/examples/quick/scenegraph/CMakeLists.txt +++ b/examples/quick/scenegraph/CMakeLists.txt @@ -7,7 +7,7 @@ if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) add_subdirectory(graph) add_subdirectory(fboitem) add_subdirectory(openglunderqml) - add_subdirectory(textureinthread) + add_subdirectory(opengltextureinthread) add_subdirectory(twotextureproviders) endif() if(MACOS) diff --git a/examples/quick/scenegraph/textureinthread/CMakeLists.txt b/examples/quick/scenegraph/opengltextureinthread/CMakeLists.txt index d29a5c63f3..daf2ef9e5f 100644 --- a/examples/quick/scenegraph/textureinthread/CMakeLists.txt +++ b/examples/quick/scenegraph/opengltextureinthread/CMakeLists.txt @@ -1,7 +1,7 @@ -# Generated from textureinthread.pro. +# Generated from opengltextureinthread.pro. cmake_minimum_required(VERSION 3.14) -project(textureinthread LANGUAGES CXX) +project(opengltextureinthread LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -9,22 +9,26 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quick/scenegraph/textureinthread") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/opengltextureinthread") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Quick) -add_qt_gui_executable(textureinthread +add_qt_gui_executable(opengltextureinthread ../shared/logorenderer.cpp ../shared/logorenderer.h main.cpp threadrenderer.cpp threadrenderer.h ) -target_include_directories(textureinthread PUBLIC +target_include_directories(opengltextureinthread PUBLIC ../shared ) -target_link_libraries(textureinthread PUBLIC +target_link_libraries(opengltextureinthread PUBLIC Qt::Core Qt::CorePrivate Qt::Gui @@ -39,23 +43,23 @@ set(textureinthread_resource_files "main.qml" ) -qt6_add_resources(textureinthread "textureinthread" +qt6_add_resources(opengltextureinthread "textureinthread" PREFIX "/scenegraph/textureinthread" FILES ${textureinthread_resource_files} ) -install(TARGETS textureinthread +install(TARGETS opengltextureinthread RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) -set_target_properties(textureinthread PROPERTIES +set_target_properties(opengltextureinthread PROPERTIES QT_QML_MODULE_INSTALL_QMLTYPES TRUE QT_QML_MODULE_VERSION 1.0 QT_QML_MODULE_URI SceneGraphRendering ) -qt6_qml_type_registration(textureinthread) +qt6_qml_type_registration(opengltextureinthread) diff --git a/examples/quick/scenegraph/textureinthread/doc/images/textureinthread-example.jpg b/examples/quick/scenegraph/opengltextureinthread/doc/images/opengltextureinthread-example.jpg Binary files differindex 59134e07c4..59134e07c4 100644 --- a/examples/quick/scenegraph/textureinthread/doc/images/textureinthread-example.jpg +++ b/examples/quick/scenegraph/opengltextureinthread/doc/images/opengltextureinthread-example.jpg diff --git a/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc b/examples/quick/scenegraph/opengltextureinthread/doc/src/opengltextureinthread.qdoc index b8446ec212..3c26138332 100644 --- a/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc +++ b/examples/quick/scenegraph/opengltextureinthread/doc/src/opengltextureinthread.qdoc @@ -26,11 +26,11 @@ ****************************************************************************/ /*! - \example scenegraph/textureinthread + \example scenegraph/opengltextureinthread \title Scene Graph - Rendering FBOs in a thread \ingroup qtquickexamples \brief Shows how to use FramebufferObjects in a thread together with Qt Quick. - \image textureinthread-example.jpg + \image opengltextureinthread-example.jpg */ diff --git a/examples/quick/scenegraph/textureinthread/error.qml b/examples/quick/scenegraph/opengltextureinthread/error.qml index 6c300af808..6c300af808 100644 --- a/examples/quick/scenegraph/textureinthread/error.qml +++ b/examples/quick/scenegraph/opengltextureinthread/error.qml diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/opengltextureinthread/main.cpp index cb00946bf7..08bf8ff66a 100644 --- a/examples/quick/scenegraph/textureinthread/main.cpp +++ b/examples/quick/scenegraph/opengltextureinthread/main.cpp @@ -63,6 +63,9 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); + // this example is only compatible with OpenGL + QQuickWindow::setSceneGraphBackend(QSGRendererInterface::OpenGLRhi); + if (!QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ThreadedOpenGL)) { QQuickView view; view.setSource(QUrl("qrc:///scenegraph/textureinthread/error.qml")); diff --git a/examples/quick/scenegraph/textureinthread/main.qml b/examples/quick/scenegraph/opengltextureinthread/main.qml index eefee92f15..51a3744f76 100644 --- a/examples/quick/scenegraph/textureinthread/main.qml +++ b/examples/quick/scenegraph/opengltextureinthread/main.qml @@ -52,36 +52,10 @@ import QtQuick 2.0 import SceneGraphRendering 1.0 -Item { +Rectangle { width: 400 height: 400 - - // The checkers background - ShaderEffect { - id: tileBackground - anchors.fill: parent - - property real tileSize: 16 - property color color1: Qt.rgba(0.9, 0.9, 0.9, 1); - property color color2: Qt.rgba(0.85, 0.85, 0.85, 1); - - property size pixelSize: Qt.size(width / tileSize, height / tileSize); - - fragmentShader: - " - uniform lowp vec4 color1; - uniform lowp vec4 color2; - uniform highp vec2 pixelSize; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec2 tc = sign(sin(3.14159265358979323846 * qt_TexCoord0 * pixelSize)); - if (tc.x != tc.y) - gl_FragColor = color1; - else - gl_FragColor = color2; - } - " - } + color: "lightGray" Renderer { id: renderer diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.pro b/examples/quick/scenegraph/opengltextureinthread/opengltextureinthread.pro index 4d41daa7bf..d07149a2f9 100644 --- a/examples/quick/scenegraph/textureinthread/textureinthread.pro +++ b/examples/quick/scenegraph/opengltextureinthread/opengltextureinthread.pro @@ -16,7 +16,7 @@ SOURCES += ../shared/logorenderer.cpp RESOURCES += textureinthread.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinthread +target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/opengltextureinthread INSTALLS += target OTHER_FILES += \ diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.qrc b/examples/quick/scenegraph/opengltextureinthread/textureinthread.qrc index 66eb53b736..66eb53b736 100644 --- a/examples/quick/scenegraph/textureinthread/textureinthread.qrc +++ b/examples/quick/scenegraph/opengltextureinthread/textureinthread.qrc diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp index 5fd8037193..8c07785926 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp +++ b/examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp @@ -160,7 +160,8 @@ public: , m_window(window) { // Our texture node must have a texture, so use the default 0 texture. - m_texture = m_window->createTextureFromId(0, QSize(1, 1)); + GLuint id = 0; + m_texture = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &id, 0, QSize(1, 1)); setTexture(m_texture); setFiltering(QSGTexture::Linear); } @@ -201,7 +202,7 @@ public slots: delete m_texture; // note: include QQuickWindow::TextureHasAlphaChannel if the rendered content // has alpha. - m_texture = m_window->createTextureFromId(newId, size); + m_texture = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &newId, 0, QSize(1, 1)); setTexture(m_texture); markDirty(DirtyMaterial); diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.h b/examples/quick/scenegraph/opengltextureinthread/threadrenderer.h index 96c00e7b2e..96c00e7b2e 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.h +++ b/examples/quick/scenegraph/opengltextureinthread/threadrenderer.h diff --git a/examples/quick/scenegraph/scenegraph.pro b/examples/quick/scenegraph/scenegraph.pro index b9ce61e21d..147fa9a156 100644 --- a/examples/quick/scenegraph/scenegraph.pro +++ b/examples/quick/scenegraph/scenegraph.pro @@ -5,7 +5,7 @@ qtConfig(opengl(es1|es2)?) { graph \ fboitem \ openglunderqml \ - textureinthread \ + opengltextureinthread \ twotextureproviders } |