BSP Issue

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
jf03cg
Posts: 14
Joined: Sun Apr 24, 2005 12:12 am
Location: Ontario, Canada
Contact:

BSP Issue

Post by jf03cg »

Hello, I am having a little difficulty with BSP maps that is making no sense to me....

-> When I run my app in windowed mode, Irrlicht will load the map, and all textures associated with it correctly, then just display a blank screen even though I have added the mesh to the scene and have called scene->drawAll(); method

-> When I run my app in full screen mode, Irrlicht simply craps out on the map loading. It is this call:

mesh = dotdScene->getMesh(filename);

That it crashes on..

MY question is, why is it that Irrlicht will load this mesh fine in Windowed mode, and not in Full screen mode?

I am using OpenGL, I know the Soft driver is not complete and I have spent many hours scouring over the source.

-- Thank you
Guest

Post by Guest »

could you please share some of your code? maybe that will help to solve the problem :)
jf03cg
Posts: 14
Joined: Sun Apr 24, 2005 12:12 am
Location: Ontario, Canada
Contact:

Post by jf03cg »

From dotdWorld.cpp (World Object - Loads Map)

Code: Select all

                    world::world(IrrlichtDevice *_dev)
                    {
                        dotdDevice = _dev;
                        dotdScene = _dev->getSceneManager();
                        dotdDriver = _dev->getVideoDriver();
                    }

                    int world::load(char* filename, char *from)
                    {
                        int i=0, result=0, x=0, y=0, z=0;
                        
                        _bsp_entity temp;
                        
                        mesh = dotdScene->getMesh(filename);
                        node = 0;
                        if(mesh)
                            node = dotdScene->addOctTreeSceneNode(mesh->getMesh(0));
                        else return ERR_NOFILE;
                        
                        if(node){
                            // Find the right Starting Point
                            result = DOTD::BSP::getBSPEntity(filename, "dotd_player_start", i, &temp);
                            while(strcmp(temp.data[DOTD::BSP::getProp(&temp,"map_from")]->value,from) && !result)
                            {
                                i++;
                                result = DOTD::BSP::getBSPEntity(filename, "dotd_player_start", i, &temp);
                            }
                            if (result) return result;
                            DOTD::BSP::getTripletI(temp.data[DOTD::BSP::getProp(&temp,"origin")]->value,&x,&y,&z);
                            node->setPosition(vector3df(x,y,z));
                            
                            dotdScene->addCameraSceneNodeFPS();
                        }    
                        else return ERR_NOMEM; 
                        
                        return ERR_NOERR;
                              
                    }
                    int world::update()
                    {
                        dotdScene->drawAll();
                    }

From dotdGame.cpp (Function that calls World Object)

Code: Select all

        int newGame(char *player)
        {
            // The World Object
            DOTD::CLASS::world *_myWorld = new DOTD::CLASS::world(dotdDevice);
            
            // The Event Receiver
            gameEventReceiver receiver;
            dotdDevice->setEventReceiver(&receiver);
            
            // We are in our map world thing
            char curMap[] = "START";
            char *mapFile, *temp;

            // Add Our Texture Library To The Game
            DOTD::IO::getINIStr(config->appRes,"GAME","TEX",&temp);
            mapFile = (char*)malloc(strlen(config->appDir)+30+strlen(temp));
            strcpy(mapFile,config->appDir); strcat(mapFile,"data\\levels\\"); strcat(mapFile,temp);
            dotdDevice->getFileSystem()->addZipFileArchive(mapFile);
            free(temp); free(mapFile);
            
            // Get Map Filename
            DOTD::IO::getINIStr(config->appRes,player,"Player.Start",&temp);
            mapFile = (char*)malloc(strlen(config->appDir)+30+strlen(temp));
            strcpy(mapFile,config->appDir); strcat(mapFile,"data\\levels\\"); strcat(mapFile,temp);

            int result = _myWorld->load(mapFile, curMap);
            if(result) return result;
            
            while(dotdDevice->run())
            {
                dotdDriver->beginScene(true, true, SColor(0,0,0,0));
                _myWorld->update();
                dotdDriver->endScene();
            }
    
            // Destroy
            _myWorld->~world();
           free(temp); free(mapFile); 
        }

Please excuse the mesinesss, I have removed some large comment blocks for readability ... Basically,

The World Object:

-Loads a BSP mesh
-Finds an entity names dotd_player_start that matches the map the player just came from
-Puts the player at the position that entity is at.


The newGame function:

-Creates a game object for the player the user is currently playing as
-Loads a texture ZIP file as specified by the DOTD.RES file
-Loads the map for the player as specified by the DOTD.RES file
-Does a game loop for the level

That is as far as I have gotten.....

Thank you for helping.... ;)
jf03cg
Posts: 14
Joined: Sun Apr 24, 2005 12:12 am
Location: Ontario, Canada
Contact:

Post by jf03cg »

Okay, Here is an update...

I found that if I set the eventReceiver for the device to a global class, then it fixes the problem for the soft. driver, but it does breaks it for the OpenGL driver .... After I undid all of the changes I made OpenGL won't work arghhh! :evil:

Will re-do when I get home from work. .... :twisted:
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

GFXstyLER wrote:read the funking manual
what funking manual?

if you think that sig will detour noobs then uh... well just think about it for a moment. took me less time to realise that wouldn't work then it did for you to write it.

not that I care or anything just an observation.
Guest

Post by Guest »

has that something to do with the thread ? :) i didnt point to my signature this time ...
jf03cg
Posts: 14
Joined: Sun Apr 24, 2005 12:12 am
Location: Ontario, Canada
Contact:

Post by jf03cg »

This is kinda weird but I think I found the problem. For some reason, unbenknown to me ...

1. The mesh will load on OpenGL and Soft mode, in WINDOWED mode only, and Only if Audiere is initialized and turned on ....

2. Loading the mesh if audeire is initialized and the program is not in windowed mode, will crash the program

3. Loading the mesh if audiere is not initialized will crash the program no matter what it is running.

When I say the mesh loads fine, I mean it does not crash. Irrlicht reports that the mesh has 0 nodes and 0 polys (But it has these)???

Anyways, if there are any suggestions please forward them ... :)
There is no such thing as a stupid question, ...
There are quite inquisitive idiots however...
jf03cg
Posts: 14
Joined: Sun Apr 24, 2005 12:12 am
Location: Ontario, Canada
Contact:

Post by jf03cg »

nm, got it working ... lol :)
There is no such thing as a stupid question, ...
There are quite inquisitive idiots however...
Post Reply