Stefan Pfeifer
Stefan Pfeifer

Reputation: 680

What's the best way to draw 2D graphics over a Qt3D scene?

I have a Qt3DWindow which contains some 3D stuff. It is displayed as a widget in my Qt application using QWidget::createWindowContainer(QWindow*).

What would be the preferred way to draw some 2D graphics (like text, basic shapes, etc.) on top of this? Normally I would override QWidget::paintEvent and use a QPainter inside, but that's not possible with a Qt3DWindow because it's not a widget.

Upvotes: 4

Views: 1450

Answers (1)

Florian Blume
Florian Blume

Reputation: 3345

This could help you. Put this on top of your 3D view and you can draw text and shapes within the widget. It is not directly drawing on the 3D surface but I'm not sure if that's easily possible. If you want to achieve something like a HUD in video games you have to add a framegraph branch that does an orthographic projection of the respective textures.

Upvotes: 2

Related Questions