Simple 3d drawing

  • Moderators

    Hi everyone,

    I've made a small program with Qt, that basically represents a 4d-Cube (aka Hypercube or Tesseract)

    A nice little exercise to get back into touch with matrices, rotations and projections.

    However, due to my complete lack of knowledge anything 3D rendering, I ended up projecting the 4d points all the way down to a 2d plane to than draw them in a QML canvas2d.

    It works, and if you're interested in the code, the project can be found here:

    But, I would like to draw it in 3D right away.

    Qt offers at least 3 different ways to draw in 3D - openglwidget, Canvas3D(QML) and Qt3d - has anyone any experience with one of these und would know how to draw a List/Vector of a container(QVector3d, QGenericmatrix, double[] etc.) representing 3d Coordinates of Points with connecting lines.

    I've gone through the docu, but all examples I found don't really fit and/or are very complicated. Like I said, next to no 3d experience, but I would like to know more. Or I've looked under the wrong keywords :-(

    If anyone could point me in the right direction or could point to an example of drawing simple 3D points in Qt, I would really appreciate it!!

  • Moderators

    with much time and an extensive amout of google search I managed to cobble a working QOpenGLWidget program together.

    I used this official Qt-Example as a basline:

    here is the combination with my Tesseract code

    It's working, yeah me!!, but I have the feeling that it's far from ideal. I'm just glad I managed to draw something in 3d.

    Anyway, closed and solved.


Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.