Opengl with QML
-
@ashajg said in Opengl with QML:
Hi
Do QML components use opengl internally?
Yes, QtQuick is all based on OpenGL, it's all drawn using your GPU :-) In Qt6, a more flexible backend will be used. it will use different renderers as needed (OpenGL, Vulkan, DirectX etc.).
Can anyone suggest starting point to study QtQuick with opengl?
What do you want to learn?
-
You can start learning how OpenGL works. Start learning modern OpenGL. This will help.
-
@sierdzio said in Opengl with QML:
What do you want to learn?
Hi @sierdzio thanks for help!!!
Just wanted to know how to use opengl with qml.
But as you said it uses opengl internally, I don't think
I need to add any extra implementation to do the same. -
@dheerendra Sir Thanks for the help!!!!
I ll start looking into modern OpenGl.
-
Not all QtQuick graphics programming requires knowledge of opengl. It depends on what you are doing:
https://github.com/Demolishun/MeetupGameHackathon1It may be worthwhile learning the other interfaces as well.
Edit:
Also, the books on Qt cover a lot of this:
books
You can get ALL the packt books on a $10/month sub. -
I assume you already know that Qt Quick modules are C++ modules designed to be registered with QML and then used in a .qml form as if they were QML Items. I also assume you understand why Qt Creator is the BEST IDE to use if you are coding Qt Qml apps. Now, Qt Creator happens to be bundled with an example called "Scene Graph - OpenGL Under QML" which is a good place for you to start from. That example uses a Squircle class which is subclassed from QQuickItem and is then registered with QML from the main.cpp file --> https://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html .
.....................
From there, I suggest you then study how to subclass a class derived from QQuickFrameBufferObject instead of QQuickItem.. As the module name suggests, the Qt codemeisters designed this module to simplify coding Modern OpenGL Qt apps which use VAOs, VBOs, shaders, projection perspective matrices, and the whole ball of wax.
.......................
But, alas, I do not think Qt Creator comes bundled with a QQuickFrameBufferObject example (which, IMHO, is THE way to code Qt OpenGL apps). I suggest you study a book authored by Marek Krajewsji, entitled "Hands-on High Performance Programming with Qt5", which includes a QQuickFrameBufferObject example. O'Reilly (formerly Safari Books Online) has this book which you can study online by subscribing to their site --> https://www.oreilly.com/library/view/hands-on-high-performance/9781789531244/a5d0d818-f4cf-467f-8c79-49b0e7002b2c.xhtml
.................
Here is a qt.io link to a QQuickFramebufferObject example --> https://www.qt.io/blog/2015/05/11/integrating-custom-opengl-rendering-with-qt-quick-via-qquickframebufferobject