[Interest] qml or qwidget
Alexandre Ribeiro
alexandregomesribeiro at gmail.com
Fri Feb 23 14:55:50 CET 2018
The approach I followed to render OpenGL was this one:
http://blog.qt.io/blog/2015/05/11/integrating-custom-op
engl-rendering-with-qt-quick-via-qquickframebufferobject/
I did it this way because I wanted to have my own QQuickItem that I could
easily instantiate in Qml.
My 3D application has a ListView on the left side with a bunch of possible
views of the scene. Each item of this ListView is a Renderer (the name I
gave to my QQuickItem that implements a QQuickFrameBufferObject). The main
view is also a renderer that renders the view that's selected from the
ListView.
The Renderer class implements a renderer interface that's API agnostic,
i.e. I could easily have the same interface for DirectX or OpenGL. This
abstracts a renderer api user from dealing with DirectX/OpenGL/Vulkan/Metal
specificities.
I then created an entity component system engine to allow my application to
be fully decoupled from the renderer. My engine is very similar to Unity
(with much less functionality though), so similar that I can literally
copy/paste code from Unity to my Qt project and it just works (after doing
the necessary tweaking to convert from C# to C++).
I instantiate my 3D engine in QML and pass it as a parameter to the
Renderer. When the Renderer needs to update (e.g. the user resizes the
window or QML animates something) it calls the 3D engine update method,
which in turn goes through the active scene and renders all scene objects.
I didn't use Qt3D because it's still unstable in macOS and the risk of
fixing bugs in a codebase I don't know/control is much higher than fixing
bugs introduced by myself or people sitting near me. From what I've seen
Qt3D is also an ECS and very complete. In my case I didn't need most of
this functionality and that made my decision easier.
On Fri, Feb 23, 2018 at 1:10 PM, Sylvain Pointeau <
sylvain.pointeau at gmail.com> wrote:
> Hi,
>
> On Thu, Feb 22, 2018 at 4:42 PM, Alexandre Ribeiro <
> alexandregomesribeiro at gmail.com> wrote:
>
>> I'm using Qt Quick 2 with an in house 3D engine for a desktop application
>> and I've been getting great results.
>>
>> My clients actually required that we used an UI that wasn't native and
>> that had a web 2.0 look, so the Qml/C++/OpenGL combination was a godsend.
>>
>
>
> This is exactly what I was looking for, I don't really need native look &
> feel anyway
> Please could you elaborate on the approach you have taken?
> did you follow this approach http://doc.qt.io/qt-5/qtquick-
> scenegraph-openglunderqml-example.html ?
>
> Best regards,
> Sylvain
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180223/8789d7c8/attachment.html>
More information about the Interest
mailing list