Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unhandled exception using Qt53DRenderd.dll in VC 2013 proj

Unhandled exception using Qt53DRenderd.dll in VC 2013 proj

Scheduled Pinned Locked Moved General and Desktop
c++qt3dqt5.6
7 Posts 3 Posters 2.7k Views 1 Watching
  • 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.
  • PoortiP Offline
    PoortiP Offline
    Poorti
    wrote on last edited by Poorti
    #1

    Hi All,

    I am a newbie in Qt. Currently using Qt5.6 and VC 2013 on Win7.
    I came across a sample in qt3d that uses the assimp lib (assimp-cpp). I tried that on QtCreator and it ran without issues. However, when I tried to use the same code in my VC++ sample project, I encountered runtime exception on the execution of the following statement,

    engine.setRootEntity(sceneRoot);
    

    Please find a screenshot of the error attached here.

    I am trying to use this snippet inside my Adobe Illustrator plugin.

    After breaking the exception, I get this.

    Can anyone guide me here?
    Am I missing any dll references or something?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      We don't have much code to work on so this will just be a guess.

      Is sceneRoot a non-null pointer to a valid object (i.e. created with new and not destroyed)?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • PoortiP Offline
        PoortiP Offline
        Poorti
        wrote on last edited by Poorti
        #3

        Thanks for replying!

        This is the code,

        	int argc = 0;
        	QApplication* _Application = static_cast<QApplication *>(QApplication::instance());
        	_Application = new QApplication(argc, 0, true);
        
        	view = new Window(); // view is a global object of Window type.
        	view->setPosition(10, 100);
        	Qt3DCore::QAspectEngine engine;
        	Qt3DInput::QInputAspect *inputAspect = new Qt3DInput::QInputAspect();
        	engine.registerAspect(new Qt3DRender::QRenderAspect());
        	engine.registerAspect(inputAspect);
        	QVariantMap data;
        	data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(view)));
        	data.insert(QStringLiteral("eventSource"), QVariant::fromValue(view));
        	engine.setData(data);
        
        	// Root entity
        	Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
        
        	//// Scene Camera
        	Qt3DCore::QCamera *basicCamera = new Qt3DCore::QCamera(sceneRoot);
        	basicCamera->setProjectionType(Qt3DCore::QCameraLens::PerspectiveProjection);
        	basicCamera->setAspectRatio(view->width() / view->height());
        	basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
        	basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
        	basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
        	basicCamera->setNearPlane(0.001f);
        	basicCamera->setFarPlane(10000.0f);
        	// For camera controls
        	inputAspect->setCamera(basicCamera);
        
        	//// Forward Renderer FrameGraph
        	Qt3DRender::QFrameGraph *frameGraphComponent = new Qt3DRender::QFrameGraph(sceneRoot);
        	Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
        	forwardRenderer->setCamera(basicCamera);
        	forwardRenderer->setClearColor(Qt::black);
        	frameGraphComponent->setActiveFrameGraph(forwardRenderer);
        	sceneRoot->addComponent(frameGraphComponent);
        
        	// Scene loader
        	Qt3DCore::QEntity *sceneLoaderEntity = new Qt3DCore::QEntity(sceneRoot);
        	Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(sceneLoaderEntity);
        	SceneWalker sceneWalker(sceneLoader);
        	QObject::connect(sceneLoader, &Qt3DRender::QSceneLoader::statusChanged, &sceneWalker, &SceneWalker::onStatusChanged);
        	sceneLoaderEntity->addComponent(sceneLoader);
        
        	std::string url = GetURL();
        
        	QString source = "file:///";
        	source.append(url.c_str());   // This gives us a url to a local file eg, file:///C:/work/qt/model.dae
        
        	QUrl sourceFileName = source;
        	if (sourceFileName.isEmpty())
        		return 0;
        
        	sceneLoader->setSource(sourceFileName);
        
        	engine.setRootEntity(sceneRoot);
        
        	view->show();
        

        Looks like sceneRoot is a non-null pointer to a valid object.

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4
          • You are leaking memory like a bandit
          • The QApplication constructor is invalid, please see the warning here: http://doc.qt.io/qt-5/qapplication.html#QApplication
            replace
           int argc = 0;
              QApplication* _Application = static_cast<QApplication *>(QApplication::instance());
              _Application = new QApplication(argc, 0, true);
          

          with

           char  arg0[] = "programName";
              char* argv[] = { &arg0[0], NULL };
              int   argc = (int)(sizeof(argv) / sizeof(argv[0])) - 1;
              QApplication the_application(argc, &argv[0]);
          

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0
          • PoortiP Offline
            PoortiP Offline
            Poorti
            wrote on last edited by
            #5

            Thanks for pointing that out VRonin!

            I updated the code as pointed out.
            Can you guide me on that exception please?

            1 Reply Last reply
            0
            • NeoswN Offline
              NeoswN Offline
              Neosw
              wrote on last edited by Neosw
              #6

              I think that sceneRoot must be not the parent of the frame graph.
              You have forgot to set a rendering surface.
              The FrameGraph root node must be a QRenderSettings

                //// Forward Renderer FrameGraph
                  Qt3DRender::QFrameGraph *frameGraphComponent = new Qt3DRender::QFrameGraph(sceneRoot);
                  Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
                  forwardRenderer->setCamera(basicCamera);
                  forwardRenderer->setClearColor(Qt::black);
                  frameGraphComponent->setActiveFrameGraph(forwardRenderer);
                  sceneRoot->addComponent(frameGraphComponent);
              

              to:

                    //// Forward Renderer FrameGraph
                  Qt3DRender::QRenderSettings *frameGraphComponent = new Qt3DRender::QRenderSettings(); //not set the parent
                  Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
                  forwardRenderer->setCamera(basicCamera);
                  forwardRenderer->setClearColor(Qt::black);
                  forwardRenderer->surface(view); //add a surface for the rendering loop
                  frameGraphComponent->setActiveFrameGraph(forwardRenderer);
                  sceneRoot->addComponent(frameGraphComponent);
              

              There are me be a mistake when you set the root entity.
              In the Qt3DWindow the root entity is set like follow:

              157	void Qt3DWindow::showEvent(QShowEvent *e)
              158	{
              159	    if (!m_initialized) {
              160	        if (m_userRoot != nullptr)
              161	            m_userRoot->setParent(m_root);
              162	
              163	        m_root->addComponent(m_renderSettings);
              164	        m_root->addComponent(m_inputSettings);
              165	        m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(m_root));
              166	
              167	        m_initialized = true;
              168	    }
              169	
              170	    QWindow::showEvent(e);
              171	}
              

              https://code.woboq.org/qt5/qt3d/src/extras/defaults/qt3dwindow.cpp.html

              Me be change you code to:

                  engine.setRootEntity(Qt3DCore::QEntityPtr(sceneRoot));
              
              PoortiP 1 Reply Last reply
              1
              • NeoswN Neosw

                I think that sceneRoot must be not the parent of the frame graph.
                You have forgot to set a rendering surface.
                The FrameGraph root node must be a QRenderSettings

                  //// Forward Renderer FrameGraph
                    Qt3DRender::QFrameGraph *frameGraphComponent = new Qt3DRender::QFrameGraph(sceneRoot);
                    Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
                    forwardRenderer->setCamera(basicCamera);
                    forwardRenderer->setClearColor(Qt::black);
                    frameGraphComponent->setActiveFrameGraph(forwardRenderer);
                    sceneRoot->addComponent(frameGraphComponent);
                

                to:

                      //// Forward Renderer FrameGraph
                    Qt3DRender::QRenderSettings *frameGraphComponent = new Qt3DRender::QRenderSettings(); //not set the parent
                    Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
                    forwardRenderer->setCamera(basicCamera);
                    forwardRenderer->setClearColor(Qt::black);
                    forwardRenderer->surface(view); //add a surface for the rendering loop
                    frameGraphComponent->setActiveFrameGraph(forwardRenderer);
                    sceneRoot->addComponent(frameGraphComponent);
                

                There are me be a mistake when you set the root entity.
                In the Qt3DWindow the root entity is set like follow:

                157	void Qt3DWindow::showEvent(QShowEvent *e)
                158	{
                159	    if (!m_initialized) {
                160	        if (m_userRoot != nullptr)
                161	            m_userRoot->setParent(m_root);
                162	
                163	        m_root->addComponent(m_renderSettings);
                164	        m_root->addComponent(m_inputSettings);
                165	        m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(m_root));
                166	
                167	        m_initialized = true;
                168	    }
                169	
                170	    QWindow::showEvent(e);
                171	}
                

                https://code.woboq.org/qt5/qt3d/src/extras/defaults/qt3dwindow.cpp.html

                Me be change you code to:

                    engine.setRootEntity(Qt3DCore::QEntityPtr(sceneRoot));
                
                PoortiP Offline
                PoortiP Offline
                Poorti
                wrote on last edited by Poorti
                #7

                @Neosw
                Thanks a lot!!
                It seems there was some kind of bug in Qt5.6 which stopped the model from rendering.
                I updated to Qt5.7 and it worked!
                :)

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved