Qt6 and Ogre

Problems building or running the engine, queries about how to use features etc.
joshikanamani
Gnoblar
Posts: 1
Joined: Tue May 13, 2025 8:37 am

Qt6 and Ogre

Post by joshikanamani »

Hi all,

I'm trying to integrate OGRE with Qt, and I have a few questions:

Code: Select all

 Which is more compatible with OGRE: QtWidgets or QML? 

Which build system is better for OGRE integration: CMake or qmake?

Which Qt version is compatible with OGRE : Qt5 or Qt6?

My requirement is to load a URDF file and display it in a GUI using Qt.

OGRE Version: 14.4.0
Operating System: Ubuntu 24.04

Code: Select all

link_directories(/usr/local/lib)

# Ogre headers
include_directories(
    /usr/include/OGRE
    /usr/local/include/OGRE
    /usr/local/include/OGRE/Bites
    /usr/include/OGRE/RTShaderSystem
    /usr/include/OGRE/RenderSystems
    /usr/include/OGRE/bin
    /usr/include/OGRE/lib

/home/joshika/workSpace/QtProject/Repo/ogre
/home/joshika/workSpace/QtProject/Repo/ogre/Components/Bites/src
/home/joshika/workSpace/QtProject/Repo/ogre/Components/Bites/include

/home/joshika/workSpace/QtProject/Repo/ogre/build
/home/joshika/workSpace/QtProject/Repo/ogre/build/include
/home/joshika/workSpace/QtProject/Repo/ogre/build/OgreMain
/home/joshika/workSpace/QtProject/Repo/ogre/build/plugins
/home/joshika/workSpace/QtProject/Repo/ogre/build/Dependencies/include
/home/joshika/workSpace/QtProject/Repo/ogre/build/lib
/home/joshika/workSpace/QtProject/Repo/ogre/build/bin
/home/joshika/workSpace/QtProject/Repo/ogre/build/Components/Bites
/home/joshika/workSpace/QtProject/Repo/ogre/build/Components/RTShaderSystem
/usr/local/share/OGRE/Media/models
)


# Ogre Libraries
target_link_libraries(ogreWidget
    Qt${QT_VERSION_MAJOR}::Widgets

# OGRE core libs — order matters
OgreMain
OgreRTShaderSystem
OgreOverlay
OgreBites
OgreBitesQt

# Ogre plugins
RenderSystem_GL
RenderSystem_GL3Plus
RenderSystem_GLES2


# Bullet if used
OgreBullet
OgrePaging
OgreMeshLodGenerator

# External libs
SDL2
freetype
pugixml
GL
)

# Library search paths
link_directories(
    /usr/lib
    /usr/local/lib
    /home/joshika/workSpace/QtProject/Repo/ogre/build/lib
    /home/joshika/workSpace/QtProject/Repo/ogre/build/bin

)

when I'm trying to integrate Ogre in Cmake getting Linker errors, I included all libs and required path, still getting same error, provided error below:

Code: Select all

[0/1 0.0/sec] Re-running CMake...
-- Found OGRE
--   static     : OFF
--   components : Bites;Bullet;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain;Volume
--   plugins    : Plugin_BSPSceneManager;Plugin_OctreeSceneManager;Plugin_PCZSceneManager;Plugin_ParticleFX;RenderSystem_GL;RenderSystem_GLES2;RenderSystem_GL3Plus;Codec_STBI;Codec_FreeImage
--   media      : /usr/local/share/OGRE-14.4/Media
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/build/Desktop_Qt_6_8_0-Debug
[1/5 66.7/sec] Automatic MOC and UIC for target ogreWidget
[2/4 2.3/sec] Building CXX object CMakeFiles/ogreWidget.dir/mainwindow.cpp.o
[3/4 2.7/sec] Linking CXX executable ogreWidget
FAILED: ogreWidget 
: && /bin/g++ -DQT_QML_DEBUG -g  CMakeFiles/ogreWidget.dir/ogreWidget_autogen/mocs_compilation.cpp.o CMakeFiles/ogreWidget.dir/main.cpp.o CMakeFiles/ogreWidget.dir/mainwindow.cpp.o CMakeFiles/ogreWidget.dir/OgreApp.cpp.o -o ogreWidget -L/usr/local/lib -Wl,-rpath,/usr/local/lib:/home/joshika/Qt/6.8.0/gcc_64/lib:/usr/local/lib/OGRE:  /home/joshika/Qt/6.8.0/gcc_64/lib/libQt6Widgets.so.6.8.0  /usr/local/lib/libOgreBitesQt.so.14.4  /usr/local/lib/OGRE/RenderSystem_GL.so.14.4  /usr/local/lib/OGRE/RenderSystem_GL3Plus.so.14.4  /usr/local/lib/OGRE/RenderSystem_GLES2.so.14.4  /usr/local/lib/libOgreBullet.so  /usr/local/lib/libOgrePaging.so.14.4  /usr/local/lib/libOgreMeshLodGenerator.so.14.4  -lSDL2  -lfreetype  -lpugixml  -lGL  /usr/local/lib/libOgreBites.so.14.4  /usr/local/lib/libOgreRTShaderSystem.so.14.4  /usr/local/lib/libOgreOverlay.so.14.4  /home/joshika/Qt/6.8.0/gcc_64/lib/libQt6Gui.so.6.8.0  /usr/lib/x86_64-linux-gnu/libGLX.so  /usr/lib/x86_64-linux-gnu/libOpenGL.so  /home/joshika/Qt/6.8.0/gcc_64/lib/libQt6Core.so.6.8.0  -ldl  /home/joshika/workSpace/QtProject/Repo/ogre/build/Dependencies/lib/libBulletDynamics.a  /home/joshika/workSpace/QtProject/Repo/ogre/build/Dependencies/lib/libBulletCollision.a  /home/joshika/workSpace/QtProject/Repo/ogre/build/Dependencies/lib/libLinearMath.a  /home/joshika/workSpace/QtProject/Repo/ogre/build/Dependencies/lib/libBulletSoftBody.a  /usr/local/lib/libOgreMain.so.14.4  -lpthread  -Wl,-rpath-link,/home/joshika/Qt/6.8.0/gcc_64/lib && :
/usr/bin/ld: CMakeFiles/ogreWidget.dir/OgreApp.cpp.o: in function `OgreApp::initializeOgre()':
/home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:40:(.text+0x454): undefined reference to `Ogre::Root::showConfigDialog()'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:46:(.text+0x5ca): undefined reference to `Ogre::Root::initialise(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:47:(.text+0x672): undefined reference to `Ogre::Root::createRenderWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int, bool, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Ogre::STLAllocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> > > const*)'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:49:(.text+0x6b8): undefined reference to `Ogre::Root::createSceneManager(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:51:(.text+0x76f): undefined reference to `Ogre::Camera::setPosition(float, float, float)'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:52:(.text+0x794): undefined reference to `Ogre::Camera::lookAt(float, float, float)'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:56:(.text+0x877): undefined reference to `Ogre::Viewport::setBackgroundColour(Ogre::ColourValue const&)'
/usr/bin/ld: /home/joshika/workSpace/QtProject/URDFVIewer/ogreWidget/OgreApp.cpp:60:(.text+0x941): undefined reference to `Ogre::Vector3::ZERO'
/usr/bin/ld: CMakeFiles/ogreWidget.dir/OgreApp.cpp.o: in function `Ogre::NedPoolingPolicy::allocateBytes(unsigned long, char const*, int, char const*)':
/usr/include/OGRE/OgreMemoryNedPooling.h:73:(.text._ZN4Ogre16NedPoolingPolicy13allocateBytesEmPKciS2_[_ZN4Ogre16NedPoolingPolicy13allocateBytesEmPKciS2_]+0x2e): undefined reference to `Ogre::NedPoolingImpl::allocBytes(unsigned long, char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/ogreWidget.dir/OgreApp.cpp.o: in function `Ogre::NedPoolingPolicy::deallocateBytes(void*)':
/usr/include/OGRE/OgreMemoryNedPooling.h:77:(.text._ZN4Ogre16NedPoolingPolicy15deallocateBytesEPv[_ZN4Ogre16NedPoolingPolicy15deallocateBytesEPv]+0x18): undefined reference to `Ogre::NedPoolingImpl::deallocBytes(void*)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
13:21:20: The process "/home/joshika/Qt/Tools/CMake/bin/cmake" exited with code 1.
13:21:20: Error while building/deploying project ogreWidget (kit: Desktop Qt 6.8.0)
13:21:20: When executing step "Build"

Note: An example(Qt6(widgets or qml) and Ogre) would be greatly appreciated, if available.

Thanks in advance

JohnWestman
Gnoblar
Posts: 1
Joined: Sat May 17, 2025 1:08 am

Re: Qt6 and Ogre

Post by JohnWestman »

I followed this example: https://github.com/ran-err/tryOgreQt

I am working in Ogre 1, so I can't speak to NEXT. Interestingly while I've not gotten Ogre to do much yet, I have gotten it to integrate well with Qt. It's kind of odd considering that other engines are easier to use, but integrating with Qt is an impossible feature from the stars that could never work.

I managed to build a QWidgets overlay that floats ontop of the Ogre scene and can be resized and dismissed and such. It's even translucent. The performance seems alright. I had to do some manual forwarding/translation of mouse and keyboard events, but Qt integration has never been the issue for me.

If you just want to cram Ogre into a view on the side of the application, I imagine you could get away with something even simpler. I'm not sure what would be the best example to refer to then.