Video loaded twice in demo

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
Mircea Popescu
Posts: 26
Joined: Sat Jan 02, 2010 12:48 pm

Video loaded twice in demo

Post by Mircea Popescu »

I don't understand why getvideodriver() is called twice in the demo example ? Namely, once in cdemo::run

Code: Select all

void CDemo::run()
{
[...]
	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();
	gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
[...]
}
and then in cdemo::loadscenedata

Code: Select all

void CDemo::loadSceneData()
{
	// load quake level

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* sm = device->getSceneManager();
[...]
}
What is the point of doing this ? Thanks.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

maybe because device is global and driver and sm are not and this are two different functions !?!?!
just a wild guess !!! :twisted:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Mircea Popescu
Posts: 26
Joined: Sat Jan 02, 2010 12:48 pm

Post by Mircea Popescu »

Well yes, but moreover, why would you want to do that ?! I mean logically, do all the video stuff in one function, rather than have to get the device twice ? No ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, there are two drivers used, hence also two calls.
Mircea Popescu
Posts: 26
Joined: Sat Jan 02, 2010 12:48 pm

Post by Mircea Popescu »

Hm... well I still can't quite figure why that is.

And since we're on the can't figure line, why does changing the resolution to 1024 768 crash the screen shoots ? (ie, if I modify

Code: Select all

	core::dimension2d<u32> resolution ( 800, 600 );
in cdemo.cpp to 1024, 768, pressing F9 crashes the demo).
Mircea Popescu
Posts: 26
Joined: Sat Jan 02, 2010 12:48 pm

Post by Mircea Popescu »

With some testing it turns out the 1024x768 resolution issue was a local problem, strictly due to bad directx9/videocard interaction. Nothing to do with Irrlicht
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Mircea Popescu wrote:Well yes, but moreover, why would you want to do that ?! I mean logically, do all the video stuff in one function, rather than have to get the device twice ? No ?
if you like so then do it... :lol:
I also do it this and other ways in different projects... ;)

and note that there are not 2 drivers in question, just 2 pointers to THE driver !!! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply