}
// texture doesn't exist, load it
textureID = GLTextureRoutines.allocateTextureID();
ThreadWorkRecipe recipe = new ThreadWorkRecipe();
recipe.add(loadImageWork, workerExecutorService);
if (scaleParams != null) {
recipe.add(imageReducingWork, workerExecutorService, newWidth, newHeight, scaleParams);
}
recipe.add(imageConversionWork, workerExecutorService);
recipe.add(glTextureUploadWork, glExecutorService, textureID);
recipe.add(idMapUpdateWork, workerExecutorService, identifier, textureID);
recipe.nextWork(recipe, inputStream);
if (wait) {
try {
recipe.loopPollResultingCallParams(glExecutorService);
}
catch (InterruptedException e) {
new Exception(S.sprintf("Failed to load texture '%s'.", identifier), e).printStackTrace();
}
}