Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved 2D&3D animation designer by Qt

    General and Desktop
    3
    12
    433
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hamed_ta last edited by hamed_ta

      hello,

      I'm developing a 3D/2D LED dot matrix display boards' designer program which should be able to animate the text, graphic items, and also be able to add movies and some other object to a scene and let the users design their own animated program them render and create a file for boards.

      the approach I have chosen to do that is using Qt widget application, the main scene object is a QGraphicsScene with a QOpenGLWidget as it's View Port and using QGraphicsItem, QGraphicsItemAnimation and other Qt graphical libraries to animate text and objects, for future 3D animations I planned to use OpenGL object will be drawn in the same QGraphicsScene, but in the middle of the way the problem is that I'am experiencing lags, low animation speed, high CPU utilization and more important not finding any method to control the speed and step of the animation to render the designed animation program into a file which LED board can read,

      so I guess maybe I'm in wrong way! do you have any other and better approach to develop such a like programs in Qt ?

      here is a picture of a other LED designed program which works very smooth ![0_1566236936218_02.png]

      and here is a picture of my program

      1 Reply Last reply Reply Quote 0
      • H
        hamed_ta last edited by hamed_ta

        Any comment ?

        1 Reply Last reply Reply Quote 0
        • A
          Asperamanca last edited by Asperamanca

          GraphicsView is no longer actively developed, it is considered "Done". Therefore, the number of developers working on it is probably not that high.

          While I have worked with GraphicsView for the past 10 years, I have never attempted to integrate video or 3D graphics, so I cannot comment on those. In general, GraphicsView does not support multithreading or graphics hardware, so performance can be rather limited for certain use cases.

          In general, it is hard to help without any more specific information on what you try to do, and some sample code. Ideally, you can roll your performance problem in a complete, short code sample, so someone else can reproduce and understand it.

          H 1 Reply Last reply Reply Quote 4
          • H
            hamed_ta @Asperamanca last edited by

            @asperamanca

            thank you for answering, well what's the best approach to be able to draw simple 3D and 2D animation with text and graphics and displaying movie clips in a scene with Qt ? therefor I can take pixels frame to frame and then convert them to the color data ?

            I can share some codes, where do you really want to know ?

            1 Reply Last reply Reply Quote 0
            • H
              hamed_ta last edited by

              anyone any comment ?

              1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion last edited by

                Hi
                Would it be an option to use QML?
                It should have way better performance on accelerated hardware.
                For test you could try using the widget the can show QML in a widget application
                and test it out while keeping the GUI (the editor) as is.

                H 1 Reply Last reply Reply Quote 0
                • H
                  hamed_ta @mrjj last edited by

                  @mrjj thank you

                  but I have implemented all the classes and methods in c++ and it's a huge wortk to port them to the QML, but do you think it could solve all the problems ? while I have a QML splash screen in the begining of the program which is shown by a Qwidget but doesn't work most the times ?

                  1 Reply Last reply Reply Quote 0
                  • mrjj
                    mrjj Lifetime Qt Champion last edited by

                    Hi
                    C++ objects / classes can be exposed to QML allowing QML to call c++ functions so
                    anything not directly involved in drawing could most likely be kept as c++.
                    I was thinking of using
                    https://doc.qt.io/qt-5/qquickwidget.html#details
                    as a drawing canvas and GUI and such still, be c++ / Widgets.

                    However, i can't promise it will solve all your problems as we dont know what the problems come from.
                    The Graphics View Framework is normally pretty fast and use a bsp tree to draw huge number of objects
                    and supports LOD ( level of detail) and zooming and panning out of the box.
                    However, its has not been optimized for animation and video even its still possible.
                    However, since you already use QOpenGLWidget, im a bit surprised it lags considering it
                    seems to be a farily small area, you need to render.

                    • but doesn't work most the times ?
                      You mean it randomly do not display the splash screen on the same pc or on different pcs?
                    H 1 Reply Last reply Reply Quote 2
                    • H
                      hamed_ta @mrjj last edited by

                      @mrjj

                      so do you think I can just change the draw approach in to the QML and easily control every other things in C++ ?
                      also in future I need to be able to draw 3D text animations in same viewport as 2D and control them frame by frame ?

                      the problems I have now is a few things first: I can't easily control movments for every frame, I need to stop the animation at the end of each frame and render the pixel data and it should be very fast I mean I need to move forward through frame very faster than normal time.

                      second, there is no way to have various animation types I mean for example the animation framework just suppots very simple animations like moving from left to right or vise versa while I need to more professional and eye catching animations like drawing a text pixel by pixel.

                      third it works really slow specially when user works on a big full colored board and add many texts and other graphics objects.

                      do you think QML has a solution for each problems or maybe I need to draw everything with OpenGL low level methods ? or maybe there would be a library in C++ or OpenGL for such purpose?

                      about QML in object container, I added a QML page in to a QQuickView but it most the times doesn't work and acording to the code it just load a simple image, especially when I compile the program in debug mode look

                      SplashDialog::SplashDialog(QWidget *parent) :
                          QDialog(parent),
                          ui(new Ui::SplashDialog),
                          m_QMLview(new QQuickView()),
                          m_container(new QWidget()),
                          m_sbLabel(new QLabel)
                      {
                          //-------------------------------------------------------------
                          utils::ConstructorMSG(this);
                          //-------------------------------------------------------------
                          ui->setupUi(this);
                          //-------------------------------------------------------------
                          setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
                          //-------------------------------------------------------------
                          QSurfaceFormat format;
                      
                          format.setProfile(QSurfaceFormat::CoreProfile);
                          format.setDepthBufferSize(24);
                          format.setStencilBufferSize(8);
                          format.setSamples(4);
                      
                          connect(m_QMLview,&QQuickView::statusChanged,this,&SplashDialog::onstatusChanged);
                      
                          m_QMLview->setFormat(format);
                          m_QMLview->setResizeMode(QQuickView::SizeRootObjectToView);
                          m_QMLview->setSource(QUrl("qrc:/main.qml"));
                      
                          while (m_QMLview->status() == QQuickView::Loading);
                      
                          if (m_QMLview->status() == QQuickView::Ready)
                          {
                              m_container = QWidget::createWindowContainer(m_QMLview, this);
                              m_container->setFocusPolicy(Qt::TabFocus);
                              ui->ly->addWidget(m_container);
                              showWave();
                              showVersion();
                          } else
                          {
                              QPixmap pix(":/images/res/images/splashBack.png");
                              m_sbLabel->setPixmap(pix);
                              ui->ly->addWidget(m_sbLabel);
                              showWave();
                          }
                      

                      so if it happen for the QML view for boards it will be worse.

                      1 Reply Last reply Reply Quote 0
                      • mrjj
                        mrjj Lifetime Qt Champion last edited by

                        Hi
                        Sorry for the late reply. it drifted away.

                        • so do you think I can just change the draw approach in to the QML and easily control every other things in C++
                          well its certainly possible but will take some boilerplate code.

                        Im not sure QML animations allows such fine control.
                        Seems to be mostly duration.
                        So not sure QML would cure all of your issues.

                        Could you try one of the QML samples and see if that also randomly doesn't work. that's easier than to think about if something up with the splash screen code.

                        To sum up. You can test with QML and see if it can be used the way you need for the export.

                        if not, then raw openGL should be the cure for all.

                        H 1 Reply Last reply Reply Quote 1
                        • H
                          hamed_ta @mrjj last edited by

                          @mrjj

                          To sum up. You can test with QML and see if it can be used the way you need for the export.
                          if not, then raw openGL should be the cure for all.

                          well, they are both huge changes and I don't want to go through except I am sure of that, so do you or anyone else see any program like this to make sure of the right approach ?

                          thank you ;)

                          mrjj 1 Reply Last reply Reply Quote 0
                          • mrjj
                            mrjj Lifetime Qt Champion @hamed_ta last edited by

                            @hamed_ta
                            I
                            Since games are made with openGL im sure its fast enough but i agree
                            using it directly is really lowlevel.

                            I think if it was my project, i would first insert timing functions
                            in all major function to get an idea where it uses all the time.

                            Also if you do disk IO after each frame, that will also cost.

                            So its hard to say what is the right thing to try with no data to look at telling if
                            its just too slow overall or if one or more features could be tuned to provide more
                            performance.

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post