Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Advanced-Effects/QtQuick-OpenGL-Widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QtQuick-OpenGL-Widget

Display an OpenGL context within a QML / QtQuick application.

Required dependencies

  • Qt6 (Qt6Core, Qt6Gui, Qt6Quick2 and QML)
  • OpenGL (glfw3)

How to use

1. Download the code.

  • Download the repo and add it to your project.
  • Or add the project as a git submodule (git submodule init and git submodule add quickglwidget https://github.com/Advanced-Effects/QtQuick-OpenGL-Widget)
  • RECOMMENDED: Download it automatically and hassle-free using CMake ExternalProject utility.

2. Link with your project's main executable and libraries.

  • If you downloaded the project or used git submodules, add this to your main CMakeLists.txt:
add_subdirectory(path/to/QtQuick-OpenGL-Widget)

# Your project's target
add_executable(<ReplaceWithYourProjectName> main.cpp)
# Or
add_library(<ReplaceWithYourLibraryName> header.h)

# Link this project with your project
target_link_libraries(<ReplaceWithYourProjectName> PRIVATE QtQuickOpenGLWidget)
target_link_libraries(<ReplaceWithYourLibraryName> PRIVATE QtQuickOpenGLWidget)
  • If you used ExternalProject:
# Includes the 'ExternalProject' functions
include(ExternalProject)

ExternalProject_Add(GLWidget # put whatever name you want here
        GIT_URL https://github.com/Advanced-Effects/QtQuick-OpenGL-Widget)

target_link_libraries(<ReplaceWithYourProjectName> PRIVATE GLWidget)

3. How to use in your code

// Somewhere in your application
// (Before the QML engine is loaded, perhaps at main.cpp)
#include <OpenGLWidget.h>
import QtQuick 2.15

import OpenGLWidget 1.0

OpenGLWidget {
        id: root
}

About

Display an OpenGL context within a QML / QtQuick application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published