Page 1 of 1

Video loaded twice in demo

Posted: Tue Jan 05, 2010 3:16 pm
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.

Posted: Tue Jan 05, 2010 4:26 pm
by Acki
maybe because device is global and driver and sm are not and this are two different functions !?!?!
just a wild guess !!! :twisted:

Posted: Tue Jan 05, 2010 5:22 pm
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 ?

Posted: Tue Jan 05, 2010 5:37 pm
by hybrid
No, there are two drivers used, hence also two calls.

Posted: Tue Jan 05, 2010 6:07 pm
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).

Posted: Tue Jan 05, 2010 6:19 pm
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

Posted: Wed Jan 06, 2010 4:07 pm
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 !!! ;)