Best method for cross-platform GPU accelerated drawing, other than Qt Quick?
-
I have a Qt 6.2 app that's cross-platform for macOS and Windows, and I'm working on a feature that requires hardware accelerated drawing. Specifically, I need render hundreds (perhaps thousands) of dynamic, animated 2D polygons with per-vertex colors and alpha blending in a full-screen transparent window, and preferably at 60 fps or better. This of course is no problem for modern graphics hardware, but would be tough if done purely on the CPU.
After doing some research, it seems that the recommendation as of late is to use Qt Quick for hardware accelerated drawing since it uses modern backends like DirectX and Metal, and is well optimized. However, my app is in C++ and uses widgets, not Qt Quick, so unless there's no other alternatives, I'd prefer not to utilize Qt Quick for this. The alternative seems to be the Graphics View Framework. From what I've read, that's only hardware accelerated with OpenGL.
Ordinarily that would be just fine for my needs, but Apple has deprecated OpenGL and will probably completely remove it from macOS at some indeterminate point in the future. When that happens, I think I would find myself in some trouble if I implemented this drawing in OpenGL.
So now I'm not sure what to do!
Is there any plan to update Graphics View to use something other than OpenGL for hardware accelerated rendering, for when Apple finally drops OpenGL from macOS? If not, that means to me that it's likely not a good choice for me.
If I were to use Qt Quick, is it appropriate for rendering polygons with per vertex colors and alpha? (I ask because Graphics View doesn't have that capability, and when using it I'd have to write custom OpenGL to accomplish it. I'm hoping to avoid having to write per-platform rendering implementations!)
Is there perhaps another alternative I've missed, other than Graphics View or Qt Quick?
-
You could try QQuickWidget. It has some performance overhead compared to QQuickView, but it embeds well with widgets, and uses the same rendering pipeline as Qt Quick (although it does not use a separate rendering thread, but performance in that context is something you would need to test, anyway)
-
You could also go more low level and render into QWidgets using QRhi, see https://doc.qt.io/qt-6/qtgui-overview.html#rhi-graphics
-
You could also go more low level and render into QWidgets using QRhi, see https://doc.qt.io/qt-6/qtgui-overview.html#rhi-graphics
@Asperamanca said in Best method for cross-platform GPU accelerated drawing, other than Qt Quick?:
You could also go more low level and render into QWidgets using QRhi, see https://doc.qt.io/qt-6/qtgui-overview.html#rhi-graphics
Damn, this would be perfect, but my software still targets macOS 10.14 so Qt 6.6 is not an option for me. (I just realized I forgot to mention I'm on Qt 6.2 in my original post, so I'll edit that.)