Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


progress bar and different functions?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 cozzie   Members   -  Reputation: 1779

Like
0Likes
Like

Posted 01 March 2014 - 10:52 AM

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')


Edited by cozzie, 01 March 2014 - 10:53 AM.


Sponsor:

#2 Aardvajk   Crossbones+   -  Reputation: 6301

Like
1Likes
Like

Posted 01 March 2014 - 01:54 PM

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.



#3 cozzie   Members   -  Reputation: 1779

Like
0Likes
Like

Posted 01 March 2014 - 01:56 PM

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



#4 King Mir   Members   -  Reputation: 2050

Like
0Likes
Like

Posted 01 March 2014 - 04:33 PM

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.

#5 cozzie   Members   -  Reputation: 1779

Like
0Likes
Like

Posted 01 March 2014 - 06:19 PM

Thanks, I'll have to get into managing multiple threads then




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS