i am in the middle of a project to make a webgl version of some java code i have that is written in opengl. I am using GWT to do this. I have a canvas generated and i can load resources via xhr requests but my issue is i don't know how to go from loading a bunch of resources to getting to a point that i know they are loaded and can be used.
The xhr requests are all setup to run (there is an undetermined number of these, but known at run time), if i stick a while loop in afterwards it will block the processing of the xhr requests so i basically get a an unresposive browser from that point onwards. So the while loop is a bad idea, so the question is how best to design the code such that i can fire off a lot of xhr requests and effectively sleep in the main loop until they are done? The second question is, assuming there is an answer to the first, how best to implement the previous answer in GWT.
To give some more context, i want to load 10 textures and then build the scene data to send to webgl. For a cube texture as an example i would need to wait for 6 textures to build the webgl cube texture