Qt 3D Studio Runtime: Dynamic Loading Example | OpenGL Runtime 2.7.0

OpenGL Runtime | OpenGL Runtime | Qt 3D Studio Runtime: Dynamic Loading Example

Qt 3D Studio OpenGL Runtime 2.7 Manual

# Qt 3D Studio Runtime: Dynamic Loading Example

Demonstrates how resources can be loaded dynamically.

This example demonstrates deferred loading.

## Running the Example

To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.

## Description

The presentation consists of three slides with images, effect, subpresentation and custom material. Images and subpresentation are loaded dynamically before entering the slide using the preloadSlide function and unloaded when exiting a slide using the unloadSlide function.

      Presentation {
          property string slidePath: "dynamicloading:Scene:Slide"
          property int curSlideIndex: 1
          property int maxSlideIndex: 3

          id: presentation
          delayedLoading: true
          source: "qrc:/presentation/dynamicloading.uia"

          onSlideEntered: {
              console.log("Entered: " + name)

              curSlideIndex = index + 1
              if (curSlideIndex > maxSlideIndex)
                  curSlideIndex = 1
              console.log("preloadSlide: " + slidePath + curSlideIndex)
              preloadSlide(slidePath + curSlideIndex)
          }

          onSlideExited: {
              console.log("Exited: " + name)
              unloadSlide(name)
          }
      }

Files:

- dynamicloading/StartupProgress.qml
- dynamicloading/dynamicloading.pro
- dynamicloading/main.cpp
- dynamicloading/main.qml
- dynamicloading/qml.qrc

Images:

- dynamicloading/presentation/maps/Abstract_001_COLOR.jpg
- dynamicloading/presentation/maps/Blue_Marble_002_COLOR.jpg
- dynamicloading/presentation/maps/Ice_002_COLOR.jpg
- dynamicloading/presentation/maps/Metal_Streaks.png
- dynamicloading/presentation/maps/Moon_001_COLOR.jpg
- dynamicloading/presentation/maps/Rock_023_COLOR2.jpg