Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to setup Ogre3D in Qt Creator with MinGW
Forum Updated to NodeBB v4.3 + New Features

How to setup Ogre3D in Qt Creator with MinGW

Scheduled Pinned Locked Moved Solved Installation and Deployment
8 Posts 2 Posters 634 Views 2 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.
  • 8 Offline
    8 Offline
    8Observer8
    wrote on 23 Oct 2021, 15:30 last edited by 8Observer8
    #1

    Hello,

    I built Ogre3D with CMake GUI and MingGW statically. I used MinGW from Qt from here: C:\Qt5\Tools\mingw810_32\bin.

    Now I have libraries (.a) for Ogre3D. I create an Empty Project with qmake. It works with SFML but I cannot run this simple example from Ogre3D repository: BasicTutorial1.cpp

    I included all libraries from Ogre3D. But I have 598 errors. My setttings:

    CONFIG += c++11
    CONFIG -= console
    
    INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\dist\include"
    INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\OgreMain\include"
    INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\Bites\include"
    INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\RTShaderSystem\include"
    
    LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\lib"
    #LIBS += -lCodec_STBIStatic -lOgreBitesStatic -lOgreMainStatic -lOgreRTShaderSystemStatic -lPlugin_ParticleFXStatic
    LIBS += -lCodec_STBIStatic -lDefaultSamples -lOgreBitesStatic -lOgreGLSupportStatic -lOgreMainStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreTerrainStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GL3PlusStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic
    
    LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\Dependencies\lib"
    LIBS += -lSDL2 -lfreetype -lpugixml
    
    LIBS += -lopengl32
    
    SOURCES += \
    main.cpp
    

    Errors:
    Ogre3DQtCreatorErrors_598_0.png

    Ogre3DQtCreatorErrors_598_1.png

    1 Reply Last reply
    0
    • 8 Offline
      8 Offline
      8Observer8
      wrote on 25 Oct 2021, 18:37 last edited by
      #6

      It was a problem with the libs order: Why does the order in which libraries are linked sometimes cause errors in GCC?

      I found the right order:

      CONFIG += c++11
      CONFIG -= console
      
      INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\dist\include"
      INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\OgreMain\include"
      INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\Bites\include"
      INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\RTShaderSystem\include"
      
      LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\lib"
      #LIBS += -lCodec_STBIStatic -lOgreBitesStatic -lOgreMainStatic -lOgreRTShaderSystemStatic -lPlugin_ParticleFXStatic
      LIBS += -lDefaultSamples -lOgreBitesStatic -lRenderSystem_GL3PlusStatic -lOgreGLSupportStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic -lOgreMainStatic -lOgreTerrainStatic -lCodec_STBIStatic -lzlibstatic
      
      LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\Dependencies\lib"
      LIBS += -lSDL2main -lSDL2.dll -lfreetype -lpugixml
      
      LIBS += -lopengl32 -lgdi32
      
      SOURCES += \
      main.cpp
      
      1 Reply Last reply
      2
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 23 Oct 2021, 18:22 last edited by
        #2

        Hi,

        Are you using a pre-built version of Ogre ?
        Which compiler was used to build it ?
        Is the build for the correct architecture ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • 8 Offline
          8 Offline
          8Observer8
          wrote on 23 Oct 2021, 19:47 last edited by 8Observer8
          #3

          I use Windows 10 64-bit. I have only one compiler on my laptop. It is MinGW 32-bit that is from Qt 5.15.2 32-bit:

          >> mingw32-make -version 
          GNU Make 4.2.1
          Built for i686-w64-mingw32
          

          I used this compiler with "CMake GUI" that is 32-bit:

          4b11e300-dd6a-4a4f-9976-fcc024615997-image.png

          to build Ogre 13.1.1 from source:

          91d96896-fffb-4817-ac34-92a56e96a1a0-image.png

          I clicked "Configure". I checked "Static Plugins" and "Ogre Static". I clicked "Configure" again. I clicked "Generate". After generating (it takes ~20 minutes) I typed this command for building: mingw32-make. After this I have these libraries:

          libCodec_STBIStatic.a
          libDefaultSamples.a
          libOgreBitesStatic.a
          libOgreGLSupportStatic.a
          libOgreMainStatic.a
          libOgreMeshLodGeneratorStatic.a
          libOgreOverlayStatic.a
          libOgrePagingStatic.a
          libOgrePropertyStatic.a
          libOgreRTShaderSystemStatic.a
          libOgreTerrainStatic.a
          libOgreVolumeStatic.a
          libPlugin_BSPSceneManagerStatic.a
          libPlugin_DotSceneStatic.a
          libPlugin_OctreeSceneManagerStatic.a
          libPlugin_OctreeZoneStatic.a
          libPlugin_ParticleFXStatic.a
          libPlugin_PCZSceneManagerStatic.a
          libRenderSystem_GL3PlusStatic.a
          libRenderSystem_GLES2Static.a
          libRenderSystem_GLStatic.a
          

          And these:

          4dac05bc-7ff7-48e2-8bdb-20f8c8e30d19-image.png

          1 Reply Last reply
          0
          • 8 Offline
            8 Offline
            8Observer8
            wrote on 23 Oct 2021, 20:00 last edited by 8Observer8
            #4

            I have Python 64-bit because I tried to use the ogre-python module. This module do not work with Python 32-bit.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 23 Oct 2021, 20:25 last edited by
              #5

              You should double check the architecture anyway.

              I would also start with a shared build of Ogre as it often is easier to link to.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • 8 Offline
                8 Offline
                8Observer8
                wrote on 25 Oct 2021, 18:37 last edited by
                #6

                It was a problem with the libs order: Why does the order in which libraries are linked sometimes cause errors in GCC?

                I found the right order:

                CONFIG += c++11
                CONFIG -= console
                
                INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\dist\include"
                INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\OgreMain\include"
                INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\Bites\include"
                INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\RTShaderSystem\include"
                
                LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\lib"
                #LIBS += -lCodec_STBIStatic -lOgreBitesStatic -lOgreMainStatic -lOgreRTShaderSystemStatic -lPlugin_ParticleFXStatic
                LIBS += -lDefaultSamples -lOgreBitesStatic -lRenderSystem_GL3PlusStatic -lOgreGLSupportStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic -lOgreMainStatic -lOgreTerrainStatic -lCodec_STBIStatic -lzlibstatic
                
                LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\Dependencies\lib"
                LIBS += -lSDL2main -lSDL2.dll -lfreetype -lpugixml
                
                LIBS += -lopengl32 -lgdi32
                
                SOURCES += \
                main.cpp
                
                1 Reply Last reply
                2
                • 8 Offline
                  8 Offline
                  8Observer8
                  wrote on 26 Oct 2021, 08:09 last edited by 8Observer8
                  #7

                  My first static Release in Ogre3D and Qt Creator: FirstExample_Ogre3D_QtCreator.zip (8.83 MB)

                  The BasicTutorial1.cpp example loads the "ogrehead.mesh". In order to load models you have to set up the "resources.cfg" file:

                  2964c4bc-d8f7-4c14-9ccd-a663b1f78312-image.png

                  resources.cfg

                  [Models]
                  FileSystem=.\

                  6d1aad60-260c-407c-b799-45b5ffce3b16-image.png

                  main.cpp

                  #include "Ogre.h"
                  #include "OgreApplicationContext.h"
                  #include "OgreInput.h"
                  #include "OgreRTShaderSystem.h"
                  #include <iostream>
                  
                  using namespace Ogre;
                  using namespace OgreBites;
                  
                  class BasicTutorial1
                          : public ApplicationContext
                          , public InputListener
                  {
                  public:
                      BasicTutorial1();
                      virtual ~BasicTutorial1() {}
                  
                      void setup();
                      bool keyPressed(const KeyboardEvent& evt);
                  };
                  
                  
                  BasicTutorial1::BasicTutorial1()
                      : ApplicationContext("OgreTutorialApp")
                  {
                  }
                  
                  
                  void BasicTutorial1::setup()
                  {
                      // do not forget to call the base first
                      ApplicationContext::setup();
                      addInputListener(this);
                  
                      // get a pointer to the already created root
                      Root* root = getRoot();
                      SceneManager* scnMgr = root->createSceneManager();
                  
                      // register our scene with the RTSS
                      RTShader::ShaderGenerator* shadergen = RTShader::ShaderGenerator::getSingletonPtr();
                      shadergen->addSceneManager(scnMgr);
                  
                      // -- tutorial section start --
                      //! [turnlights]
                      scnMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
                      //! [turnlights]
                  
                      //! [newlight]
                      Light* light = scnMgr->createLight("MainLight");
                      SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
                      lightNode->attachObject(light);
                      //! [newlight]
                  
                      //! [lightpos]
                      lightNode->setPosition(20, 80, 50);
                      //! [lightpos]
                  
                      //! [camera]
                      SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode();
                  
                      // create the camera
                      Camera* cam = scnMgr->createCamera("myCam");
                      cam->setNearClipDistance(5); // specific to this sample
                      cam->setAutoAspectRatio(true);
                      camNode->attachObject(cam);
                      camNode->setPosition(0, 0, 140);
                  
                      // and tell it to render into the main window
                      getRenderWindow()->addViewport(cam);
                      //! [camera]
                  
                      //! [entity1]
                      Entity* ogreEntity = scnMgr->createEntity("ogrehead.mesh");
                      //! [entity1]
                  
                      //! [entity1node]
                      SceneNode* ogreNode = scnMgr->getRootSceneNode()->createChildSceneNode();
                      //! [entity1node]
                  
                      //! [entity1nodeattach]
                      ogreNode->attachObject(ogreEntity);
                      //! [entity1nodeattach]
                  
                      //! [cameramove]
                      camNode->setPosition(0, 47, 222);
                      //! [cameramove]
                  
                      //! [entity2]
                      Entity* ogreEntity2 = scnMgr->createEntity("ogrehead.mesh");
                      SceneNode* ogreNode2 = scnMgr->getRootSceneNode()->createChildSceneNode(Vector3(84, 48, 0));
                      ogreNode2->attachObject(ogreEntity2);
                      //! [entity2]
                  
                      //! [entity3]
                      Entity* ogreEntity3 = scnMgr->createEntity("ogrehead.mesh");
                      SceneNode* ogreNode3 = scnMgr->getRootSceneNode()->createChildSceneNode();
                      ogreNode3->setPosition(0, 104, 0);
                      ogreNode3->setScale(2, 1.2, 1);
                      ogreNode3->attachObject(ogreEntity3);
                      //! [entity3]
                  
                      //! [entity4]
                      Entity* ogreEntity4 = scnMgr->createEntity("ogrehead.mesh");
                      SceneNode* ogreNode4 = scnMgr->getRootSceneNode()->createChildSceneNode();
                      ogreNode4->setPosition(-84, 48, 0);
                      ogreNode4->roll(Degree(-90));
                      ogreNode4->attachObject(ogreEntity4);
                      //! [entity4]
                  
                      // -- tutorial section end --
                  }
                  
                  
                  bool BasicTutorial1::keyPressed(const KeyboardEvent& evt)
                  {
                      if (evt.keysym.sym == SDLK_ESCAPE)
                      {
                          getRoot()->queueEndRendering();
                      }
                      return true;
                  }
                  
                  
                  int main(int argc, char **argv)
                  {
                      try
                      {
                          BasicTutorial1 app;
                          app.initApp();
                          app.getRoot()->startRendering();
                          app.closeApp();
                      }
                      catch (const std::exception& e)
                      {
                          std::cerr << "Error occurred during execution: " << e.what() << '\n';
                          return 1;
                      }
                  
                      return 0;
                  }
                  
                  1 Reply Last reply
                  0
                  • 8 Offline
                    8 Offline
                    8Observer8
                    wrote on 27 Oct 2021, 13:27 last edited by 8Observer8
                    #8

                    I did not make "mingw32-make install" after "mingw32-make". I set CMAKE_INSTALL_PREFIX to install path in "CMake GUI". After the "mingw32-make install" command all content will be in one place:

                    c3f85fe2-b81f-4abd-b55e-f2cf9154e764-image.png

                    the .pro is more clear:

                    INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE"
                    INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE\Bites"
                    INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE\RTShaderSystem"
                    
                    LIBS += -L"E:\ProgramFiles\ogre-13.1.1\lib"
                    LIBS += -L"E:\ProgramFiles\ogre-13.1.1\lib\OGRE"
                    
                    LIBS += -lOgreBitesStatic -lRenderSystem_GL3PlusStatic -lOgreGLSupportStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic -lOgreMainStatic -lOgreTerrainStatic -lCodec_STBIStatic -lzlibstatic
                    LIBS += -lSDL2main -lSDL2.dll -lfreetype -lpugixml
                    LIBS += -lopengl32 -lgdi32
                    
                    1 Reply Last reply
                    0

                    1/8

                    23 Oct 2021, 15:30

                    • Login

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