Thread: Unknown Irrlicht Error

  1. #1
    Marxist-Trotskyist
    Join Date
    May 2005
    Location
    Many, many miles from the center of the Earth.
    Posts
    31

    Unknown Irrlicht Error

    I have about 223 lines of code that, when compiled, produce no errors, but when ran, freezes for a moment, and then windows asks me if I want to send the error (that it won't identify) to their help center. There are no errors of any sort identified by the debugger or anything else, and I'm out of ideas... ...If anyone would be so kind as to debug the code for me, I would post it. Please let me know, thanks.
    If a=b, and b=c, then a=c, except where void and prohibited by law...

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    200 odd lines doesn't sound so bad - take a chance and attach the source file to your next reply

  3. #3
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Go to the irrlicht forums, they will help you in no time.
    I'm Irrlicht user myself...
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  4. #4
    The Reel Thing
    Join Date
    Jun 2005
    Posts
    44
    When that happens, I use a debugger and step through the code untill the program crashes, then I know exactly where the problem is.

    If you're loading anything externally, make sure the paths are correct and they're actually being loaded before using them. Also, make sure the pointers to the device, scene manager, driver, etc, are valid as well.
    Bagpipes – putting the fun back in funeral.

  5. #5
    Marxist-Trotskyist
    Join Date
    May 2005
    Location
    Many, many miles from the center of the Earth.
    Posts
    31
    Thanks for the replies. I didn't have the graphics in the right folder, but when I put them there (and double checked the paths) it still does the same thing. When I debugged it, it told me it can't watch this variable:

    Code:
    IAnimatedMesh* Ship1 = scenemgr->getMesh("...GFX/Crafts/Small/Civilian/Shuttle.3ds");
    I'm not really sure what that means, but here's the rest of the code, :P.

    Code:
    // Abiotica- Zero G
    // Irrlicht Headers
    #include "irrlicht.h"
    #include <iostream>
    #include <stdlib.h>
    #include <string>
    #include <stdio.h>
    #include <wchar.h>
    
    // Irrlicht Namespaces
    using namespace irr;
    using namespace core;
    using namespace scene;
    using namespace video;
    using namespace io;
    using namespace gui;
    
    using namespace std;
    
    // Declaration of Global Variables
    int quit = 0;
    
    // Classes
    // Irrlicht Initialization Class
    class Init_Irrlicht
    {
              // Private Class Variables/Functions
              
          protected:
              // Protected Class Variables/Functions
              bool FullScreen;
              int FullScreen_Choice;
              int VideoMode_Choice;
              E_DRIVER_TYPE VideoMode;
          
          public:
              // Public Class Variables/Functions
              void FuncInit_Irrlicht(void);
              E_DRIVER_TYPE FuncVideo_Mode(void);
              bool FuncFullScreen(void);
              void GFX_Irrlicht(void);
              IrrlichtDevice *device;
              IVideoDriver* driver;
              ISceneManager* scenemgr;
              IGUIEnvironment* guienv;
    };
    
    // Graphics Display Class
    class GFX_Irrlicht: public Init_Irrlicht
    {
          public:
              // Public Class Variables/Functions
              bool FuncLoad_All(void);
              void FuncLoad_GUI(void);
              void FuncDraw_All(void);
              
              IAnimatedMesh* Ship1;
              IAnimatedMeshSceneNode* Ship1Node;
    };
    
    // Event Handling Class
    class Event_Receiver: public IEventReceiver
    {
          public:
              virtual bool OnEvent(SEvent event)
              {
                   if(event.EventType == EET_KEY_INPUT_EVENT &&
                        !event.KeyInput.PressedDown)
                   {
                        switch(event.KeyInput.Key)
                        {
                        case KEY_ESCAPE:
                             {
                                  quit = 1;
                             }
                             return true;
                        }
                   }
                   
                   // Exit Without Event Trigger
                   return false;
              }
    };  
    
    
    
    // Main Game Loop
    int main()
    {
        // Initialize Irrlicht
        Init_Irrlicht IrrInit_Object;
        GFX_Irrlicht IrrGFX_Object;
        IrrInit_Object.FuncInit_Irrlicht();
        
        // Load Graphics
        IrrGFX_Object.FuncLoad_GUI();
        IrrGFX_Object.FuncLoad_All();
        
        // Main Loop
        while(quit == 0)
        {
             IrrGFX_Object.FuncDraw_All();
        }
        
        // Exit Main Function And Clean Up Irrlicht
        IrrInit_Object.device->drop();
        return 0;
    }
    
    
    
    // Function Declarations
    // Irrlicht Initialization Function
    void Init_Irrlicht::FuncInit_Irrlicht(void)
    {
        // Initialize Objects
        Event_Receiver Input_Object;
         
        // Initialize Irrlicht Engine
        // [Default]OpenGL Driver, 800x600 Display...
        // 16 Bit Depth, [Default]FullScreen
        device = createDevice(FuncVideo_Mode(), 
              dimension2d<s32>(800, 600), 16, FuncFullScreen(), false,      false, &Input_Object);
            
        // Setup Device Pointers
        driver = device->getVideoDriver();
        scenemgr = device->getSceneManager();
        guienv = device->getGUIEnvironment();
        
        // Exit Function
        return;
    }
    
    // Video Mode Query
    E_DRIVER_TYPE Init_Irrlicht::FuncVideo_Mode()
    {
        // Ask Video Mode
        cout << "Choose Video Mode...\n";
        cout << "1: Software.\n";
        cout << "2: DirectX9.\n";
        cout << "3: DirectX8.\n";
        cout << "4: OpenGL.\n";
        cin >> VideoMode_Choice;
        // Change Character String Accordingly
        switch(VideoMode_Choice)
        {
              case 1:
                   VideoMode = EDT_SOFTWARE;
                   break;
              case 2:
                   VideoMode = EDT_DIRECTX9;
                   break;
              case 3:
                   VideoMode = EDT_DIRECTX8;
                   break;
              case 4:
                   VideoMode = EDT_OPENGL;
                   break;
              default:
                   VideoMode = EDT_OPENGL;
        }
        
        // Exit Function And Return Video Mode Choice String
        return VideoMode;
    }
    
    // FullScreen Query
    bool Init_Irrlicht::FuncFullScreen()
    {
        // Initial User Setup
        // Ask Fullscreen
        cout << "Fullscreen?\n";
        cout << "1: Yes.\n";
        cout << "2: No.\n";
        cin >> FullScreen_Choice;
        // If Yes Or No, Change Appropriately; Otherwise, Fullscreen
        switch(FullScreen_Choice)
        {
              case 1:
                   FullScreen = true;
                   break;
              case 2:
                   FullScreen = false;
                   break;
              default:
                   FullScreen = true;
        }
        // Return Appropriate Boolean Value
        return FullScreen;
    }
    
    // Load All Graphics (For In-Game Purposes)
    bool GFX_Irrlicht::FuncLoad_All(void)
    {
         IAnimatedMesh* Ship1 = scenemgr->getMesh("...GFX/Crafts/Small/Civilian/Shuttle.3ds");
         IAnimatedMeshSceneNode* Ship1Node = scenemgr->addAnimatedMeshSceneNode(Ship1);
         Ship1Node->setMaterialFlag(EMF_LIGHTING, false);
         scenemgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
         
         return true;
    }
    
    // Load All Graphics (For GUI Purposes)
    void GFX_Irrlicht::FuncLoad_GUI(void)
    {
         
         
         return;
    }
    
    // Draw All Graphics (GUI Environment And Scene Manager)
    void GFX_Irrlicht::FuncDraw_All(void)
    {
         // Begin Scene Rendering
         driver->beginScene(true, true, SColor(0,200,200,200));
    
         // Draw Scene Manager and GUI Environment
       	 scenemgr->drawAll();
    	 guienv->drawAll();
    
         // End Scene Rendering
    	 driver->endScene();
         
         // Exit Function
         return;
    }
    If a=b, and b=c, then a=c, except where void and prohibited by law...

  6. #6
    Marxist-Trotskyist
    Join Date
    May 2005
    Location
    Many, many miles from the center of the Earth.
    Posts
    31
    Oh, and every other time I do it (which greatly confuses me), it tells me I have an Access Violation (Segmentation Fault). But only every other time...

    Also, in the video mode choice function, it doesn't return a string (obviously), it returns an E_DRIVER_TYPE variable. Not that it's particularly important.
    If a=b, and b=c, then a=c, except where void and prohibited by law...

  7. #7
    The Reel Thing
    Join Date
    Jun 2005
    Posts
    44
    Do a check after you load anything into memory, for example:

    Code:
    // Load the ship
    IAnimatedMesh* Ship1 = scenemgr->getMesh("...GFX/Crafts/Small/Civilian/Shuttle.3ds");
     
    // Check for existance
    if (!Ship1)
    {
      // Error handling goes here
    }
    Or something like that. If that doesn't work, hop on over to the Irrlicht forums, and they can help you out.
    Bagpipes – putting the fun back in funeral.

  8. #8
    Marxist-Trotskyist
    Join Date
    May 2005
    Location
    Many, many miles from the center of the Earth.
    Posts
    31
    I added that and it still does the same thing... . I'll post it over at Irrlicht too, I suppose. Thanks for the replies (again, :P).
    If a=b, and b=c, then a=c, except where void and prohibited by law...

  9. #9
    Marxist-Trotskyist
    Join Date
    May 2005
    Location
    Many, many miles from the center of the Earth.
    Posts
    31
    I revamped the code (a lot), and now it opens and loads the model (and texture), but won't display anything or recognize key strokes. It's only 171 lines now though.

    Code:
    // Abiotica- Zero G
    // Irrlicht Headers
    #include "irrlicht.h"
    #include <iostream>
    #include <stdlib.h>
    #include <string>
    #include <stdio.h>
    #include <wchar.h>
    
    // Irrlicht Namespaces
    using namespace irr;
    using namespace core;
    using namespace scene;
    using namespace video;
    using namespace io;
    using namespace gui;
    
    using namespace std;
    
    // Global Variables
    int VideoMode_Choice;
    int FullScreen_Choice;
    
    bool quit = false;
    bool FullScreen;
    
    IrrlichtDevice *device;
    IVideoDriver* driver;
    ISceneManager* scenemgr;
    IGUIEnvironment* guienv;
    E_DRIVER_TYPE VideoMode;
    IAnimatedMesh* Ship1;
    IAnimatedMeshSceneNode* Ship1Node;
    
    // Class Declarations
    // Event Handling Class
    class Event_Receiver : public IEventReceiver
    {
          public:
              virtual bool OnEvent(SEvent event)
              {
                   if(event.EventType == EET_KEY_INPUT_EVENT &&
                        !event.KeyInput.PressedDown)
                   {
                        switch(event.KeyInput.Key)
                        {
                        case KEY_ESCAPE:
                             {
                                  quit = true;
                             }
                             return true;
                        }
                   }
                   
                   // Exit Without Event Trigger
                   return false;
              }
    }; 
    
    // Function Outlines
    void FuncDraw_All(void);
    void FuncLoad_All(void);
    
    int main()
    {
        // Ask Fullscreen
        cout << "Fullscreen?\n";
        cout << "1: Yes.\n";
        cout << "2: No.\n";
        cin >> FullScreen_Choice;
        // If Yes Or No, Change Appropriately; Otherwise, Fullscreen
        switch(FullScreen_Choice)
        {
              case 1:
                   FullScreen = true;
                   break;
              case 2:
                   FullScreen = false;
                   break;
              default:
                   FullScreen = true;
        }
        
        // Ask Video Mode
        cout << "Choose Video Mode...\n";
        cout << "1: Software.\n";
        cout << "2: DirectX9.\n";
        cout << "3: DirectX8.\n";
        cout << "4: OpenGL.\n";
        cin >> VideoMode_Choice;
        // Change Character String Accordingly
        switch(VideoMode_Choice)
        {
              case 1:
                   VideoMode = EDT_SOFTWARE;
                   break;
              case 2:
                   VideoMode = EDT_DIRECTX9;
                   break;
              case 3:
                   VideoMode = EDT_DIRECTX8;
                   break;
              case 4:
                   VideoMode = EDT_OPENGL;
                   break;
              default:
                   VideoMode = EDT_OPENGL;
        }
        
        // Initialize Objects
        Event_Receiver Input_Object;
         
        // Initialize Irrlicht Engine
        // [Default]OpenGL Driver, 800x600 Display...
        // 16 Bit Depth, [Default]FullScreen
        device = createDevice(VideoMode, 
              dimension2d<s32>(800, 600), 16, FullScreen, false, false);
        device->setEventReceiver(&Input_Object);
            
        // Setup Device Pointers
        driver = device->getVideoDriver();
        scenemgr = device->getSceneManager();
        guienv = device->getGUIEnvironment();
        
        // Load All Graphics
        FuncLoad_All();
        
        // Main Loop
        while(quit != true)
        {
             // Graphics Display Function
             FuncDraw_All();
        }
        
        // Uninitialize Irrlicht
        device->drop();
    }
    
    
    // Draw All Graphics (GUI Environment And Scene Manager)
    void FuncDraw_All(void)
    {
         // Begin Scene Rendering
         driver->beginScene(true, true, SColor(0,0,0,0));
    
         // Draw Scene Manager and GUI Environment
       	 scenemgr->drawAll();
    	 guienv->drawAll();
    
         // End Scene Rendering
    	 driver->endScene();
         
         // Exit Function
         return;
    }
    
    // Load All Graphics
    void FuncLoad_All(void)
    {
         Ship1 = scenemgr->getMesh("C:/Dev-Cpp/Abiotica- Zero G/GFX/Crafts/Small/Civilian/Shuttle.x");
         Ship1Node = scenemgr->addAnimatedMeshSceneNode(Ship1);
         if(Ship1Node)
         {
              Ship1Node->setMaterialFlag(EMF_LIGHTING, false);
              Ship1Node->setMaterialTexture( 0, driver->getTexture("C:/Dev-Cpp/Abiotica- Zero G/GFX/Crafts/Small/Civilian/Shuttle.bmp") );
         }
         
         // Add Camera
         scenemgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
    }
    If a=b, and b=c, then a=c, except where void and prohibited by law...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  5. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM