Why irrDevice still exits even I call closeDevice()?

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
keynet
Posts: 18
Joined: Wed Jun 27, 2012 9:07 am

Why irrDevice still exits even I call closeDevice()?

Post by keynet »

Hi.

I have a little problem as I explained in the subject.

Even I call closeDevice() (I tried drop() function, too) after while(dev->run() { ] is end, the irrDevice does not disappear..

It remains like an dead window(you know, the classic MS window error that makes staircase (am I using this word right? or stair effect?))

I don't know why this happens... because I did closeDevice() and even clearSystemMessages(), too.

Does anybody has the same problem?

Please help!.
From Seoul, South Korea
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Why irrDevice still exits even I call closeDevice()?

Post by Mel »

can't tell exactly why, but i guess it is because the window still exists and won't disappear until your code ends, only it won't get updated at all, and thus, the "staircase" effect, also called "hall of mirrors". The window is created independently of the engine (so, Irrlicht can work with a window created by yourself for instance) , and provided it to work, so when the engine ends, the window remains there, i guess that you have also to drop the engine so the window gets also deleted. seems that closeDevice() shuts down the Irr device, but won't delete the window
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Ravi08
Posts: 249
Joined: Thu Jul 17, 2008 12:25 pm

Re: Why irrDevice still exits even I call closeDevice()?

Post by Ravi08 »

Havn't got a solution might explain the problem though, this happened to me when I created mulitple irr devices ie in my case I had one for the main menu then another for the game and if I moved the game window the menu window would still be underneath with the "staircase" effect.

That might explain it but not sure in your case.
"Hey Baby Wobbling Wobbling"
-Russell Peters
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Why irrDevice still exits even I call closeDevice()?

Post by Nadro »

I had similar problem, but I solved it by add a "device->run();" before drop a device, so my code looks now like this:

Code: Select all

if(Device)
{
     Device->run();
     Device->drop();
}
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
keynet
Posts: 18
Joined: Wed Jun 27, 2012 9:07 am

Re: Why irrDevice still exits even I call closeDevice()?

Post by keynet »

Oh I solved it... the problem was I didn't call clearSystemMessages() before or after calling closeDevice()!!!!!!! Holy poop

It seems if I don't call clearSystemMessages() , then irrDevice falls into infinite waiting status for some events(ex.GUI or Key Input) so that the closeDevice() couldn't close the irr window perfectly.

Thank you guys!
From Seoul, South Korea
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Why irrDevice still exits even I call closeDevice()?

Post by hybrid »

Better call run() as suggested by Nadro. This handles all events properly instead of just removing them.
Post Reply