How to create Game Loading Progress?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

How to create Game Loading Progress?

Post 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?
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

Thx.
Sadness...
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post 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 :)
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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.
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

Herewith image is changed in absolutely different functions: atoi, open, etc.

I am rectet realize RenderScreen()?
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

This bug only in OpenGL!!!
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

I am write test for this bug and create bug report.

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