Unsolved Searching QPainter but for 3D purpose (lines in 3D)
-
Hi,
I am looking for a Qt library similar to QPainter but for 3D purpose.
I want to draw "lines" but in 3D dimension.I am coding in C++.
Thank you for your help!
-
@MaelleT A rectangle in 3D is a cube right? 😄 Is this what you’re looking for? https://doc.qt.io/qt-5/qt3dextras-qcuboidmesh.html
Or perhaps other building blocks like https://doc.qt.io/qt-5/qvector3d.html#details ?
-
@tobias_m Hi! Thank you for you response but I have juste changed my post a few minutes ago XD
Now I am searching how to draw a "line" in 3D.
But thank you for your response by the way! (and yes qcuboidmesh looks great to do cubes) -
@MaelleT Yeah I saw the change 😉 If you want you can pursue the Qt3D framework a bit and see if it fits your requirements. I saw one question earlier similar to yours: https://stackoverflow.com/questions/38067867/how-do-i-draw-a-simple-line-in-qt3d.
But it doesn’t really give you a simple answer.
Is it really lines in 3D you want? Or is it 3D coordinates projected to a 2D plane? If it’s the latter you can “just” project the points you have in the 3D world to 2D coordinates then use Qpainter as usual to draw the lines between the coordinates.
I have a rough example here if you want to have a quick look:
https://github.com/tobiasmarciszko/effect-playground/blob/master/projection.cpp