Page 1 of 1

How to create Game Loading Progress?

Posted: Thu Feb 15, 2007 3:03 pm
by Magnet
I need to create loading progress.

I am select next way:
create new theard for updating window:

Code: Select all

DWORD WINAPI UpdateSplash(LPVOID data)
{
	ILoadSplash* splash = (ILoadSplash*)data;
	while(GetDevice()->run() && splash->Enable)
	{		
		GetVideoDriver()->beginScene(true, true, SColor(255,200,200,230));
		splash->BeginUpdate();
		//splash->GetSceneManager()->drawAll();
		splash->EndUpdate();
		GetVideoDriver()->endScene();		
	}
	return 0;
}
Afte creating theard a start loading function.

But theard does not updates my window :-). I have a black screen.
But I am set color (200,200,230).
As possible load the resources in separate theard?

Posted: Thu Feb 15, 2007 3:43 pm
by Magnet
I am rewrite my code and put to enoter process loading function.
All images loaded as white rectangle :-(

Irrlicht has problem with multithearding?

Posted: Thu Feb 15, 2007 5:38 pm
by vitek
It may not be Irrlicht that is causing your problems, but Irrlicht is not thread safe. You should only be rendering from one thread. You can't really even load meshes or images from a thread because the mesh/image loaders are not thread-safe; they use shared data internally.

You are going to make your life very difficult if you start to write threaded code with Irrlicht.

Travis

Posted: Fri Feb 16, 2007 2:15 pm
by Magnet
Thx.
Sadness...

Posted: Sat Feb 17, 2007 3:54 am
by BlindSide
Surely there is an alternative method for a game loading screen. Maybe do it in a serial fashion and stick an update command between every loading operation? And interpolate somehow inbetween...

Can anyone show me an example :)

Posted: Wed Feb 21, 2007 10:44 pm
by Magnet
HM. I am have a bug.

I am create function for update screen

Code: Select all

void ILoadScreen::RenderScreen()
{
	GetVideoDriver()->beginScene(true, true, SColor(255,0,0,0));
	OnBeginRenderScene();
	smgr->drawAll();
	OnEndRenderScene();
	GetVideoDriver()->endScene();
	GetDevice()->run();
}

//OnBeginRenderScene is overload for ILoadScreen::OnBeginRenderScene
void LoadLocationScreen::OnBeginRenderScene()
{
       GetVideoDriver()->draw2DImage(tezx, position2di(0,0));
}
I am run function RenderScreen for update loading screen between stage of the loading.

For example:

Code: Select all

RenderScreen();
...
//load resources
...
RenderScreen();
//load resources
..
RenderScreen();
But I have bug in process!
Line

Code: Select all

GetVideoDriver()->draw2DImage(tezx, position2di(0,0));
Do not draw texture tezx, it draws texture which is loaded at current moment.

Please take me example for create normal loading.

Posted: Wed Feb 21, 2007 11:10 pm
by Magnet
Herewith image is changed in absolutely different functions: atoi, open, etc.

I am rectet realize RenderScreen()?

Posted: Thu Feb 22, 2007 9:25 am
by Magnet
I am replace my render function with:

Code: Select all

void ILoadScreen::RenderScreen()
{
	glClearColor(0,0,0,0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	OnBeginRenderScene();
        SendMessage((HWND)GetVideoDriver()->getExposedVideoData().OpenGLWin32.HWnd, WM_PAINT, 0,0);
		SwapBuffers((HDC)GetVideoDriver()->getExposedVideoData().OpenGLWin32.HDc);
}
But this bug is remained.

I am view variable tezx in debug - this value is const (for example: 1357e88)

It is system bug?
Why is not drawn image necessary for me?

P.S. I am use Visual Studio 2005

Posted: Thu Feb 22, 2007 6:03 pm
by Magnet
This bug only in OpenGL!!!

Posted: Fri Feb 23, 2007 8:14 pm
by Magnet
I am write test for this bug and create bug report.

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=19448