Irrlicht + IrrWizard n00b problems

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
hellshady00
Posts: 5
Joined: Mon Feb 23, 2009 11:39 pm

Irrlicht + IrrWizard n00b problems

Post by hellshady00 »

Okay, after alot of other noob problems i finally managed to setup Irrlicht & the IrrWizard LITE framework and make a few minor changes.

Everything compiles fine, i only get 1 warning which is completely irrelevant atm.

The problem is that the program crashes immediately after creating the irrlicht device, even the very next statement is never ran.

Heres the only code that i can tell is relevant:

Code: Select all

void CGameManager::createDevice(wchar_t* windowCaption, irr::core::dimension2d<s32> windowRes, bool windowFullscreen) {
    std::cout<<"Creating graphics device...\n";
	//Device parameters -> renderer|screen size|colour depth|full window|shadows|vsync|input device
    m_pDevice =  irr::createDevice(EDT_OPENGL, windowRes, 16, windowFullscreen, true, false, 0);

// PROGRAM CRASHES HERE, COUT NEVER RUNS.
    std::cout<<"Setting window caption\n";
    m_pDevice->setWindowCaption(windowCaption);

    std::cout<<"Setting irrlicht device pointers:\n";
	m_pDriver = m_pDevice->getVideoDriver();
    m_pSceneManager = m_pDevice->getSceneManager();
	m_pGUIEnvironment = m_pDevice->getGUIEnvironment();
}
The last line of the output reads: GLSL not available, but i dont think that is what is causing the crash.

Just in case anyone is interested:
Doxygen -
http://shady.evilfuckerz.org

http://code.google.com/p/shady-open/downloads/ or
http://shady.evilfuckerz.org/files

SVN -
http://shady-open.googlecode.com/svn/trunk/ shady-open-read-only

That should cover it :)

Thanks in advance.
Last edited by hellshady00 on Tue Feb 24, 2009 7:40 am, edited 1 time in total.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

oh boy, I don't know where to start... :roll:

first of all, I didn't get it to work because I gave up searching for all errors you made... :lol:

but I'll tell you what I found so far:

1st: the implementation of OnEvent is wrong !!!
it must be:

Code: Select all

bool OnEvent(const SEvent& event);
2nd: you missed bracets in CGameManager::ChangeState !!!
it must be:

Code: Select all

void CGameManager::ChangeState(CGameState * pState)
{
	if (m_pGameState){ // <<<<<  missing bracet
        std::cout<<"m_pGameState->Clear\n";
		m_pGameState->Clear(this);
	} // <<<<<  missing bracet
	if ( pState != m_pGameState ) {
	    std::cout<<"Changing to new state...\n";
		m_pGameState = pState;
		m_pGameState->Init(this);
	}
}
ok, they was only silly errors... ;)

but now comes the bad things:
if you want to work with pointers, then you have to know how to work with them !!! :roll:

you're using 2 pointers (I saw so far): m_GameManager and CGameIntro
but you never create instances of them, so you're working with objects that doesn't exist !!!

I think you should create them in the CGame constructor:

Code: Select all

CGame::CGame(wchar_t* windowCaption, int x, int y, bool fullscreen) {
    // Here you would also initialize your other game engine tools, from m_GameManager

    // create new instances of the two classes !!!
    m_GameManager = new CGameManager;
    CGameIntro = new CGameIntroState;

    std::cout<<"m_GameManager->createDevice\n";
    m_GameManager->createDevice2(windowCaption, irr::core::dimension2d<s32>(x, y), fullscreen);
    m_GameManager->loadLevel(CGameIntro);
}
of course you need to release/delete them when you don't need them anymore (usually at program end)...


that's what I found so far...
I didn't want to search for more errors by now, because I think you messed up the whole code like this and it's a realy big bunch of code you have there... :lol:
hellshady00 wrote:If you can't find any irrlicht specific tutorials and you are just starting to learn C++ then you might want to check out cprogramming.com helped me alot.
maybe you should have a deeper look at it !?!?! :twisted:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hellshady00
Posts: 5
Joined: Mon Feb 23, 2009 11:39 pm

Post by hellshady00 »

Thanks...

I know there are lots of errors in the code, but why is it crashing HERE?

edit: well, i'll fix the things you mentioned and update the svn, have a look later if you get bored lol

-- btw, you said to have a deeper look at cprogramming.com, any section in particular? i always hated pointers :-p
but maybe there are other things im missing?

thanks again for finding those errors, might have taken me a while to find those myself :-p
Last edited by hellshady00 on Tue Feb 24, 2009 2:19 am, edited 1 time in total.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hellshady00 wrote:but why is it crashing HERE?
Acki wrote:you're using 2 pointers (I saw so far): m_GameManager and CGameIntro
but you never create instances of them, so you're working with objects that doesn't exist !!!
hellshady00 wrote:i'll fix the things you mentioned and update the svn, have a look later if you get bored
I won't unless you make a new download... ;)
also, if your program uses/needs assets, then include them to the download, please (b.c. it will also cause a crash if the program doesn't find the needed assets and you don't check/handle this)...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hellshady00
Posts: 5
Joined: Mon Feb 23, 2009 11:39 pm

Post by hellshady00 »

Thanks again, turns out it really wasn't that bad :)

Everything runs perfectly now, though im sure i'll run into some minor things later on.

All the links are updated if you want to check it out.

Any other help you can give me would be great :D
Post Reply