0

I have a problem with Ogre. When I start the renderer (either OpenGL or DirectX) I get an error:

Debug Assertion Failed! C: \ windows \ system32 \ msvcp110d.dll File:
C: \ Program Files (x86) \ Microsoft Visual Studio 11.0 \ VC \ include
\ xtree <- (i dont have anything in this path) Line: 237

Expression: map / set iterator not deferencable

Here is the code:

#include "OGRE\Ogre.h"
#include "OGRE\OgreException.h"
#include "OGRE\OgreRoot.h"

#include "OIS\OIS.h"

Ogre::Root* root;
Ogre::RenderWindow* window;
Ogre::SceneManager* sceneManager;
Ogre::Viewport* viewport;
Ogre::Camera* camera;
Ogre::SceneNode* cameraNode;

OIS::Keyboard* keyboard;
OIS::Mouse* mouse;
OIS::InputManager* im;

bool running = true;

void handlekeyboard()
{
    keyboard->capture();
    if (keyboard->isKeyDown(OIS::KC_ESCAPE)) running = false;
}

void handlemouse()
{
    mouse->capture();
    const OIS::MouseState& mouseState = mouse->getMouseState();
}

int main()
{
    try{
        root = new Ogre::Root("plugins_d.cfg");

        if(!root->showConfigDialog()) return 0;

        window = root->initialise(true);

        sceneManager = root->createSceneManager(Ogre::ST_GENERIC);

        camera = sceneManager->createCamera("maincamera");
        camera->setNearClipDistance(5);
        camera->setFarClipDistance(100);

        cameraNode = sceneManager->getRootSceneNode()->createChildSceneNode();
        cameraNode->attachObject(camera);

        viewport = window->addViewport(camera);
        viewport->setClearEveryFrame(true);

        size_t windowHnd = 0;
        window->getCustomAttribute("window", &windowHnd);
        std::string windowhandleassstring ="";
        std::ostringstream windowHndstr;
        windowHndstr << windowHnd;
        windowhandleassstring = windowHndstr.str();
        OIS::ParamList LSpecialParameters;
        LSpecialParameters.insert(std::make_pair(std::string("window"),windowhandleassstring));   
        im = OIS::InputManager::createInputSystem(LSpecialParameters);
        keyboard = static_cast<OIS::Keyboard*>(im->createInputObject(OIS::OISKeyboard, false));
        mouse = static_cast<OIS::Mouse*>(im->createInputObject(OIS::OISMouse, false));

        while(window->isClosed() == false && running == true)
        {
            handlekeyboard();
            handlemouse();
            root->renderOneFrame();
            Ogre::WindowEventUtilities::messagePump();
        }

    }catch(Ogre::Exception &ex)
    {
        std::cout << "error"<< ex.getDescription() << std::endl;
    }

    delete root;
    delete window;
    delete sceneManager;
    delete camera;
    delete cameraNode;
    delete viewport;

    delete keyboard;
    delete mouse;   

    return 0;
}
hon2a
  • 7,006
  • 5
  • 41
  • 55
Light
  • 1
  • Welcome to SO! So which line above is the reason for the exception? Could you find that out? Seems that you did not properly initialize Ogre http://stackoverflow.com/questions/17957656/ogresdk-1-9-1-assertion-failed, could you check this, too? Next time please also add infos about what tutorial you are trying out, or maybe not tutorial but book or so. So we are able to also watch there for more infos. Also try to say what you are actually trying to do. Do you want to create a game or just testing stuff out? – kwoxer Dec 08 '14 at 15:46
  • That guy got it working with deleting_d at the end https://bobobobo.wordpress.com/2009/05/20/ogreassertion-failed-expression-ms_singleton/. Did you already test this? So root = new Ogre::Root("plugins_d.cfg"); -> root = new Ogre::Root("plugins.cfg"); – kwoxer Dec 08 '14 at 15:47
  • Hi Kwoxer i dont know the reason for this exception! thats why im asking :) ! and i checked the settings and the code from ogre because its from an video on youtube : http://www.youtube.com/watch?v=IjQpMEszE7Q&index=65&list=UUhqqnWP6uoos-355ISnCFHQ and i test the tutorials – Light Dec 08 '14 at 16:02
  • and yes i checked the plugins ... root = new Ogre::Root("plugins_d.cfg") <- for debug; -> root = new Ogre::Root("plugins.cfg") <- for release – Light Dec 08 '14 at 16:07
  • In which code line does that crash occur? – Philip Allgaier Dec 10 '14 at 10:24

0 Answers0