progress bar and different functions?

Started by
3 comments, last by cozzie 10 years, 1 month ago

Hi,

This might sound 'stupid', but I'm thinking about a way how I can update a progress bar when loading 3d models and textures (in my engine).

The problem is that my loading function for meshes and textures is a member of a different class then my renderer. I thought about splitting the loading function up into for example 5 iterations and then update the progress, but if for example I have 1 big mesh which takes long to load and 10 others which are loaded quite fast, the progress bar seems useless.

How would you handle this?

My goal is that I print for example a '*' or a '.' in my console (d3dxfont) each 3 seconds, parallel when my loading function for the 3d scene is executed

(Ps.; I'm not using multithreading, other then 'automatically')

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Advertisement

You basically have two options:

1) Make the loading methods "callback" periodically during their operation

2) Load in a worker thread and have it signal the main thread at different points

There's no magic way around this.

Thanks. Then I'll go for option 1 now (cut the loading in smaller parts).

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

You could also have the main thread poll the progress from the worker thread. That is, the worker thread keeps track of it's progress in a variable, and the main thread occasionally queries it.
Thanks, I'll have to get into managing multiple threads then

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement