QtOgre Application Framework - Now using Qt 4.5

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
ogre_developer
Gnoblar
Posts: 5
Joined: Mon Apr 16, 2012 8:23 am

Re: QtOgre Application Framework - Now using Qt 4.5

Post by ogre_developer »

Hi all,

I have downloaded OGRE 1.7.2 SDK for MinGW (http://www.ogre3d.org/download/sdk) and I have installed it at C:\OgreSDK.

Later, I have downloaded the project demo from https://ogreaddons.svn.sourceforge.net/ ... eFramework

I have build the project with Qt Creator with MinGW Tool chain.

This is my .pro file:

Code: Select all

#-------------------------------------------------
#
# Project created by QtCreator 2012-04-16T13:19:33
#
#-------------------------------------------------

QT       += core gui xml

TARGET = demo
TEMPLATE = app

win32 {
    # You may need to change this include directory
    OGREHOME = C:/OgreSDK
    Release:LIBS += -L$$OGREHOME/bin/release
    Debug:LIBS += -L$$OGREHOME/bin/debug
    INCLUDEPATH += $$OGREHOME/include/OGRE
    INCLUDEPATH += $$OGREHOME/boost_1_44
}

CONFIG(debug, debug|release) {
  TARGET = $$join(TARGET,,,d)
  LIBS *= -lOgreMain_d
}

CONFIG(release, debug|release) {
  LIBS *= -lOgreMain
}

SOURCES += main.cpp\
        mainwindow.cpp \
    StyleSettingsWidget.cpp \
    MainMenu.cpp \
    ChooseMeshWidget.cpp \
    DemoGameLogic.cpp \
    SettingsDialog.cpp \
    OgreWidget.cpp \
    LogModelSortFilterProxy.cpp \
    LogModel.cpp \
    LogManager.cpp \
    LogEntry.cpp \
    Log.cpp \
    GraphicsSettingsWidget.cpp \
    GameLogic.cpp \
    FPSDialog.cpp \
    EventHandlingOgreWidget.cpp \
    DotSceneHandler.cpp \
    Application.cpp \
    AbstractSettingsWidget.cpp

HEADERS  += mainwindow.h \
    StyleSettingsWidget.h \
    MainMenu.h \
    DemoGameLogic.h \
    ChooseMeshWidget.h \
    SettingsDialog.h \
    QtOgreForwardDeclarations.h \
    OgreWidget.h \
    LogModelSortFilterProxy.h \
    LogModel.h \
    LogManager.h \
    LogLevel.h \
    LogEntry.h \
    Log.h \
    GraphicsSettingsWidget.h \
    GameLogic.h \
    FPSDialog.h \
    EventHandlingOgreWidget.h \
    EventHandler.h \
    DotSceneHandler.h \
    Application.h \
    AbstractSettingsWidget.h

FORMS    += mainwindow.ui \
    MainMenu.ui \
    ChooseMeshWidget.ui \
    StyleSettingsWidget.ui \
    Log.ui \
    GraphicsSettingsWidget.ui \
    FPSDialog.ui \
    SettingsDialog.ui

RESOURCES += resources/DemoResources.qrc \
    resources.qrc
The demo works properly, but the QComboBox to select the different resolutions is not filled. What's wrong?

Some screenshots:

Image

Image

Image

@PolyVox Congratulations!

Best regards.
uzik
Goblin
Posts: 202
Joined: Sun Feb 25, 2007 1:45 am
Location: USA
x 6
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by uzik »

Do the program create an ogre.log file? It might have a clue as to the problem. (It's a text file).
---A dream doesn't become reality through magic; it takes sweat, determination and hard work.
ogre_developer
Gnoblar
Posts: 5
Joined: Mon Apr 16, 2012 8:23 am

Re: QtOgre Application Framework - Now using Qt 4.5

Post by ogre_developer »

uzik wrote:Do the program create an ogre.log file? It might have a clue as to the problem. (It's a text file).
This is the Qt "Application Output" content: http://pastebin.com/kiPDfhuZ
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by PolyVox »

I'm afraid I haven't worked on this for a long time now, so I don't really remember how it worked :? I think it may get the list of resolutions from a settings or .ini file so maybe that is not being found. You should probably look in the code and try to work out where the combo box should be filled.
ogre_developer
Gnoblar
Posts: 5
Joined: Mon Apr 16, 2012 8:23 am

Re: QtOgre Application Framework - Now using Qt 4.5

Post by ogre_developer »

Hi,

I will see the code of the combo box. Another question:

The first time that I did execute the demo, the execution was aborted because missing dlls. For this reason, I copied the files: OgreMain_d.dll, libboost_thread-mgw45-mt-d-1_44.dll and plugins_d.cfg to the exe folder manually to the project works properly.

Is there another way to not perform the operation manually?

Regards.
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by PolyVox »

ogre_developer wrote:Is there another way to not perform the operation manually?
I guess you can add the dll locations to you PATH environment variable. If you dn't want to be dependant on the .dlls at all then you can investigate static linking, but it is more complex and has licensing issues with Qt.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by jacmoe »

ogre_developer wrote:Is there another way to not perform the operation manually?
You can let your build system perform that task for you. :)
Either by running a batch script as a post-build operation, or if you are using CMake: the install target.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
ogre_developer
Gnoblar
Posts: 5
Joined: Mon Apr 16, 2012 8:23 am

Re: QtOgre Application Framework - Now using Qt 4.5

Post by ogre_developer »

What is the limitations of QtOgre compared to Ogre standard?
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by PolyVox »

The actual capabilities of Ogre aren't affected, in that it still renders everthing it could before. But Qt takes over the window management and input handling, so for example it doesn't support fullscreen as nicely, doesn't autodetect resolutions, and it's more difficult to use OIS for input.
User avatar
thebluefish
Gremlin
Posts: 170
Joined: Tue Apr 05, 2011 1:55 am
x 10

Re: QtOgre Application Framework - Now using Qt 4.5

Post by thebluefish »

It took me a while getting this to build correctly. Mainly because CMake broke the projects, so I ended up remaking them anyhow. Also, the included moc files are nice, but a way of generating them outside of the qt editor would be nice. For anyone using visual studio 2010, here's a nice file for this:

Build_QT.targets

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <ItemGroup>
 <UIFiles Include="$(MSBuildProjectDirectory)\**\*.ui" />
 </ItemGroup>
 <ItemGroup>
 <MOCFiles Include="$(MSBuildProjectDirectory)\**\*.h" />
 </ItemGroup>
 <ItemGroup>
 <ResFiles Include="$(MSBuildProjectDirectory)\**\*.qrc" />
 </ItemGroup>

 <Target Name="CompileQtUI" BeforeTargets="ClCompile" Inputs="@(UIFiles)" Outputs="@(UIFiles->'$(ProjectDir)include\ui_%(Filename).h')">
 <Message Text="Compiling: %(UIFiles.FullPath) to $(ProjectDir)include\ui_%(UIFiles.Filename).h" />
 <Exec Command="..\..\QT-4.8.1\bin\uic.exe %(UIFiles.FullPath) -o $(ProjectDir)include\ui_%(UIFiles.Filename).h"/>
 </Target>
 <Target Name="CompileQtMOC" BeforeTargets="ClCompile" Inputs="@(MOCFiles)" Outputs="@(MOCFiles->'$(ProjectDir)moc\moc_%(Filename).cpp')">
 <Message Text="Compiling: %(MOCFiles.FullPath) to $(ProjectDir)moc\moc_%(MOCFiles.Filename).cpp" />
 <Exec Command="..\..\QT-4.8.1\bin\moc.exe %(MOCFiles.FullPath) -o $(ProjectDir)moc\moc_%(MOCFiles.Filename).cpp"/>
 </Target>
 <Target Name="CompileQtQRC" BeforeTargets="ClCompile" Inputs="@(ResFiles)" Outputs="@(ResFiles->'$(ProjectDir)resources\qrc_%(Filename).cpp')">
 <Message Text="Compiling: %(ResFiles.FullPath) to $(ProjectDir)resources\qrc_%(ResFiles.Filename).cpp" />
 <Exec Command="..\..\QT-4.8.1\bin\rcc.exe %(ResFiles.FullPath) -name $(ProjectName) -o $(ProjectDir)resources\qrc_%(ResFiles.Filename).cpp"/>
 </Target>
</Project>
Do note that you may need to edit the paths depending on how you want to do it, this is currently setup to put files into $(Projectdir)/include/ and $(Projectdir)/moc/.

I also had to play around with the resource configuration to get it working in my projects correctly, apparently I had to have the QtOgreStatic resource included in my main project for it to link correctly (not sure why). The issues listed above are also happening after I got the example compiled, but I will just have to fix them tomorrow. Also, the FPS counter is still drawn even with another window open, or the main app minimized. On top of that, clicking the application in the task bar doesn't bring the main window back up. Definitely plenty of stuff to fix up, but this is the first time I successfully managed an Ogre window along with QT (my previous attempts failed horribly).
During the code inspection, a couple of minor points were noticed: -

Function inlining was critical to performance.
For MSVC, at least, a "delete 0" caused execution of 11 assembly instructions, including a function call. So in cases where performance is at an absolute premium it can be worth inserting the extra manual test.
MKissee
Gnoblar
Posts: 3
Joined: Fri May 18, 2012 11:03 pm

Re: QtOgre Application Framework - Now using Qt 4.5

Post by MKissee »

are there any plans or work being done by anyone to update this to work with ogre 1.8 and qt 4.8.1 or (preferably) qt 5? i have been trying to compile under these conditions and running in to nothing but endless problems (i would post error logs etc but i am at my laptop and not my dev computer at the moment so i may post an update tomorrow if somebody thinks they might be able to help
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by PolyVox »

As the original developer I can say I have no plans to work on it further. This is because I won't be using it myself, as I have different requirements for my next project. If anyone wants to step up and maintain the code they are more than welcome. You would just need access to the Ogre Addons SVN (if it's still in SVN - did this stuff move to Git/Mercuriul?).
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by jacmoe »

Distributed vcs doesn't lend itself well to being an addon repository as you can't checkout partially, by directory, like with SVN.
So ogreaddons is still a SVN repository, and will probably stay that way.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Nort
Gnoblar
Posts: 3
Joined: Mon Oct 29, 2012 1:53 pm

Re: QtOgre Application Framework - Now using Qt 4.5

Post by Nort »

what is ui_log.h file? I can't find it neither in ogre sdk nor in qt sdk.
Using ogre 1.7.1 and latest qt sdk.
Can't compile without this header :(
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
x 18
Contact:

Re: QtOgre Application Framework - Now using Qt 4.5

Post by PolyVox »

This file isn't included in the distribution because it is automatically generated by Qt's UIC tool when you build. The CMake file should have the appropriate rules set up to make this happen. I can't be much more specific as I haven't worked with this for a long time...
Nort
Gnoblar
Posts: 3
Joined: Mon Oct 29, 2012 1:53 pm

Re: QtOgre Application Framework - Now using Qt 4.5

Post by Nort »

hm, i dont know whats cmake. Iam just using qt creater on windows, and i like it a lot.
well, can u suggest me other tool then?
Iam a student and I have to write simple game with gui and lan, i have chosen qt+ogre because i know c++ pretty well and qt basic stuff to write gui's.
looks like i have to use another gui engine for ogre? which one is most popular today?
Sapd
Gnoblar
Posts: 15
Joined: Fri Sep 09, 2011 3:19 pm

Re: QtOgre Application Framework - Now using Qt 4.5

Post by Sapd »

Iam a student and I have to write simple game with gui and lan, i have chosen qt+ogre because i know c++ pretty well and qt basic stuff to write gui's.
looks like i have to use another gui engine for ogre? which one is most popular today?
@ Nort: You want just a gui for you game or?
Use CEGUI 0.8 if you need a fully gui with a lot of features, use mygui if you need something simple.
But as i remember you need to know how to use cmake for compiling both. Can be a hard for the first time, but a lot of software uses cmake. Just download cmake-gui, download the source of the library you desire and open cmake-gui and specify the source folder of the library and choose the path where you want the build files copied to. Then click build, then you maybe need to fill in missing depedencies. Just try it.
Nort
Gnoblar
Posts: 3
Joined: Mon Oct 29, 2012 1:53 pm

Re: QtOgre Application Framework - Now using Qt 4.5

Post by Nort »

ok, i ran cmake, generated project for vs 2010 (although I need project for qt creator), it was a success, then i ran vs and tried to build this generated project, it failed but generated necessary *.h files.
Now i need qtogred.lib, where can i find it?
Post Reply