Problems with Ogre in Qt Creator Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Problems with Ogre in Qt Creator

Post by 8Observer8 »

Hello,

My settings:
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 += -L"E:\Libs\SDL2-2.0.12-mingw-32bit\lib"
LIBS += -lSDL2

SOURCES += \
main.cpp
I have 20 errors. I tried to add another libs but I cannot decrease amount of errors.

Image

I try to run a code from this link: https://github.com/OGRECave/ogre/blob/m ... orial1.cpp

Code: Select all

#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;
}
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Problems with Ogre in Qt Creator

Post by sercero »

Hello,

From your other post I guess that you have already succesfully built OGRE, as it says here:
https://ogrecave.github.io/ogre/api/1.1 ... -ogre.html

The proper way to set up your application is detailed in this guide:
https://ogrecave.github.io/ogre/api/1.12/setup.html

You will see that it is necessary to use CMake to setup the project as well.

One thing you could do is tell CMake to create a QT Creator project for you and then you open that into QT Creator to continue within the IDE.

That way CMake automatically detects the required libs, includes and linker options for your project.

In my case I use Code::Blocks and I already know how to set up things manually so I just use CMakte to compile OGRE as a lib.

But being a new user perhaps the best course of action would be to be able to compile a very simple application as it says in the guide and go from there.
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

Thank you! I will study CMake. But I is very strange that I cannot run this simple example.

I try to include all libraries (21 items):
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
I include all the "include" folders:
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"
I tried to include SDL2 from the current build of Orgre3D:
LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\SDL2-build"
LIBS += -lSDL2main
This is my settings:
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\SDL2-build"
#LIBS += -lSDL2main

LIBS += -L"E:\Libs\SDL2-2.0.12-mingw-32bit\lib"
LIBS += -lSDL2

SOURCES += \
main.cpp
But now I have 1309 issues:
Attachments
Ogre3DQtCreatorErrors_1309.png
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Problems with Ogre in Qt Creator

Post by paroj »

you are still missing the pugixml and freetype libs. Also the order in which you specify the libs matters:
https://stackoverflow.com/questions/451 ... ors-in-gcc

these things would be normally taken care of by cmake.
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I will try to run a simple example without CMake.

I did not find "freetype.a" in this folder:
E:\_Projects\Temp\ogre-13.1.1\dist\freetype-2.10.1\builds
I built the FreeType using "CMake GUI". But I have freetype-2.10.2 but Ogre uses freetype-2.10.1. I added it to my Qt Creator settings:
LIBS += -L"E:\Libs\freetype-2.10.2-mingw-32bit\lib"
LIBS += -lfreetype
It solved 7 errors. Now I have 1302 errors. I found libpugixml.a in this folder:
E:\_Projects\Temp\ogre-13.1.1\dist\pugixml-1.10
I included pugixml in Qt Creator settings:
LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\pugixml-1.10"
LIBS += -lpugixml
Now I have 971 errors:
Attachments
Ogre3DQtCreatorErrors_971.png
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I found some libs! They are here:
E:\_Projects\Temp\ogre-13.1.1\dist\Dependencies\lib
Attachments
LibsInDependencies.png
LibsInDependencies.png (10.43 KiB) Viewed 12975 times
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I tried to add this library from the folder above but the amount of errors are the same (971):
LIBS += -lzlibstatic
I added the OpenGL library:
LIBS += -lopengl32
Now amount of errors is 598. My settings:
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
Attachments
Ogre3DQtCreatorErrors_598_2.png
Ogre3DQtCreatorErrors_598_1.png
Ogre3DQtCreatorErrors_598_0.png
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I have MinGW 32-bit and I built Ogre with this compiler. I have Python 64-bit. Maybe is this problem with architecture?
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Problems with Ogre in Qt Creator

Post by sercero »

Why are you using 32-bits MinGW compiler?

I was using TDM's 32-bits MinGW a long time ago, and then switched to 64-bits version 8.1.0 and saw a very big performance speedup.

I also upgraded OGRE to 1.11 at the time so both things were a factor.

In my opinion you are not going step by step, but trying to jump.

Have first a simple application compiled the way that the tutorial say and then you add complexity step by step, otherwise you will get overwhelmed.

I cannot help you with Qt Creator since I'm using Code::Blocks, if you switch to that IDE I might be able to help you.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Problems with Ogre in Qt Creator

Post by paroj »

8Observer8 wrote: Sat Oct 23, 2021 1:50 pm Now amount of errors is 598. My settings:
please click on the link I posted above
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

Which order must be for Ogre?
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I understand. It is like for Bullet Physics Engine where building works for this order:
LIBS += -lBulletDynamics -lBulletCollision -lLinearMath
But how can I know what is the right order for Ogre libraries?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Problems with Ogre in Qt Creator

Post by paroj »

if you get undefined references to GLRenderSystemCommon in GL3PlusRenderSystem, it means that you have to move GLSupport after GL3Plus etc.
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I found a right order of libs. I have only one error:
E:\_Projects\Temp\ogre-13.1.1\PlugIns\STBICodec\include\OgreSTBICodec.h:73: error: undefined reference to `vtable for Ogre::STBIPlugin'
E:\_Projects\Temp\ogre-13.1.1\dist\lib/libOgreBitesStatic.a(OgreStaticPluginLoader.cpp.obj): In function `ZN9OgreBites18StaticPluginLoader4loadEv':
E:/_Projects/Temp/ogre-13.1.1/PlugIns/STBICodec/include/OgreSTBICodec.h:73: undefined reference to `vtable for Ogre::STBIPlugin'
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I tried to add a virtual destructor with implementation but it does not help:

Code: Select all

    class _OgreSTBICodecExport STBIPlugin : public Plugin
    {
    public:
        ~virtual STBIPlugin() {}
        const String& getName() const;
        void install() { STBIImageCodec::startup(); }
        void uninstall() { STBIImageCodec::shutdown(); }
        void initialise() {}
        void shutdown() {}
    };
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I moved -lCodec_STBIStatic to the and I added -lzlib. Now it compiles but it crashes:
Attachments
Ogre3DQtCreatorErrorsCrash.png
Ogre3DQtCreatorErrorsCrash.png (11.15 KiB) Viewed 12845 times
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I made a mistake. I wrote '-lzlib' instead of '-lzlibstatic'. And I added '-lSDL2.dll'

This configuration works:
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
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I have a little question:
All done
Mesh: Loading ogrehead.mesh.
Error occurred during execution: FileNotFoundException: Cannot locate resource ogrehead.mesh in resource group OgreAutodetect. in ResourceGroupManager::openResource at E:\_Projects\Temp\ogre-13.1.1\OgreMain\src\OgreResourceGroupManager.cpp (line 659)
I tried to place this model here:
Attachments
ogrehead.png
ogrehead.png (3.65 KiB) Viewed 12839 times
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

I built the BasicTutorial1.cpp example to Release. I placed the "ogrehead.mesh" model with exe. But when I run the exe the program cannot open this model:
Attachments
Ogre3DRelease.png
Ogre3DRelease.png (2.8 KiB) Viewed 12821 times
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Problems with Ogre in Qt Creator

Post by sercero »

In order to load models you have to set up the resources.cfg file, something like this:

Code: Select all

[Essential]
#Zip=D:\OGRE\media\packs\SdkTrays.zip

[General]
FileSystem=D:\OGRE\media\Editor
FileSystem=D:\OGRE\media\Player2b

[Models]
FileSystem=D:\OGRE\media\models
You have categories and filesystems or zip files where your models and textures are
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

Thanks! My first static Release in Ogre3D and Qt Creator: FirstExample_Ogre3D_QtCreator.zip (8.83 MB)
resources.cfg.png
resources.cfg.png (3.22 KiB) Viewed 12775 times
resources.cfg
[Models]
FileSystem=.\
Ogre3DQtCreator_TutorialApp.png
main.cpp

Code: Select all

#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;
}
8Observer8
Halfling
Posts: 78
Joined: Sat Feb 29, 2020 12:29 am
x 2

Re: Problems with Ogre in Qt Creator

Post by 8Observer8 »

Sample solution required SDL2.dll. I added it: FirstExample_Ogre3D_QtCreator.zip (9.5 MB)

Post Reply