The preface of this book tells us we are going to develop an asynchronous resources loading system in this chapter. We have completed all of the preparations for this. We are now equipped with secure memory management, task queues, and finally, the FileSystem
abstraction with archive file support.
What we want to do now is to combine all of this code to implement a seemingly simple thing: create an application that renders a textured quad and updates its texture on-the-fly. An application starts, a white quad appears on the screen, and then, as soon as the texture file has loaded from disk, the quad's texture changes. This is relatively easy to do—we just run the LoadImage
task that we implement here, and as soon as this task completes, we get the completion event on the main thread, which also owns an event queue. We cannot get away with a single mutex to update the texture data, because when we use the OpenGL texture objects in Chapter 6, Unifying OpenGL...