Hi!
I am just wonderring how to display a loading bar in the same window where I do all my drawings. For eg. imagine you run a simple demo displaying cube in the middle of a window. The cube is not textured yet!
Now by pressing ‘t’ key the prog. would load eg. 20 or more textures in run time. (this figure is just an example).
Now after pressing the key ‘t’ the program will start loading textures from a disk. Say it would take about 30 seconds to load all texs and therefore I would like to visualize all the loading process by drawing in the same window eg. below the already displayed cube a simple red rectangle which would be initially be very narrow and positioned on -200.0 along X axis. As the texture is being loaded (one by one) the rectangle would stretch to towards right side of the window to 200.0 along X. This would show the user that the program loads all those textures just like in games there are all those loading bars.
the way I can imagine is eg.
counter could be incremented for every texture loaded and automatically should update the main window in order to redraw the rectangle (stretch more an more).
Do u think that thats how its done or I am wrong.
Also I am not sure how to update the window after each texture is loaded which is my main problem. I’ve tried glutPostRedisplay() coze I am using GLUT but that didnt work. it redisplayed all my drawings in the window after all textures were loaded which is not what I want! I want to update the window everytime a texture is loaded.
The way how I’ve done now is:
void keyboard(…)
{
case ‘t’: initTex(); load textures…
break;
}
initTex()
{
//load texture 1
++counter
// update window <<— here I am not sure what to use to update the drawing before the next tex will be loaded (glutPostRedisplay() ???)
//load texture 2
++counter
// update the drawing
etc…
}
void display()
{
//draw a cude
//draw loading bar (simple quad stretching to the right eg. by 1 unit when each texture is loaded) ie.
glBegin(GL_QUADS);
glVertex2s( 0, 0 );
glVertex2s( counter, 0 );
glVertex2s( counter, 20 );
glVertex2s( 0, 20 );
glEnd();
}//end display
Any ideas! Thank you for reading my post and help!!
[This message has been edited by robert_s (edited 03-10-2002).]
[This message has been edited by robert_s (edited 03-10-2002).]