Leveraging my application from software 3d to accelerated 3d
-
Hello, I'm developing a hobby application to help me unfold facetted volumes into 2d patterns so I can build them from cardboard, fabric or paper. I started that process by first using OpenJScad (now called JSCAD), then Vanilla JS, C on Gnome, C++ on Qt, but without 3d. Last year I started to add 3d handling to my Qt Application and my main target was the WAsm version, so I made it using a software 3d logic from a great guy that published videos explaining a way to do it (see here). I only load a 3d file (.obj format), rotate/zoom the 3d view and select/unselect/color faces, and it works fine even if there's a bug that I still cannot overcome on WAsm (need to press TAB key to grab focus). Now I'm wanting to go a little farther and try to make a desktop version that uses accelerated 3d. For that, is it better to stick to C++ Widget or use QT Quick (That I never used, I'm a long time C coder and learnt C++ and Qt Widget for that project) ? Do I need to also learn hardware 3d graphics ? -
Hi,
If you leave the QOpenGLXYZ classes, widgets are not hardware accelerated.
Since it's a hobby project, I would encourage you to do some tests to learn from the tech to decide which one fits best.One thing to take into account is that the Qt3D module is being deprecated in favor of QtQuick 3D.
What do you mean by "hardware 3D graphics" ?
-
In addition to @SGaist, if you want to go "all the way", you could exchange your QtWidget layout that displays the rendered scene with a OpenGL or Vulkan rendering backend.
Might be a little much to learn at first but if you are interest, you might want to do it.
This is the only way you have full control over your rendered objects / pipeline and it will definitely run on your GPU. -
@SGaist By hardware 3d graphics I mean code that uses GPU instead of CPU, and if possible not only for 3d but also for 2d as my project uses lots of triangles that it needs to move/link/rotate/scale and also check for collision. For the moment I'm using my own classes for Vector 3d and 4x4 Matrix, I tried to use Qt classes equivalents but without success (mainly because the code I'm using needs a vector 3d with a fourth member). And I also have a 2d Triangle class, those three classes could maybe be replaced by code using the GPU.
I will first try to do like Pl45m4 said, use a Vulkan rendering backend or a Rhi, things that are absolutely new for me, so that I could keep my existing widget code, but if needed or simpler I'll start using Qt Quick. For sure I'm looking at all available examples projects.