problem description
if we load a picture, we often write:
class Car {
constructor() {
// load shader
// load texture
}
draw() {
// use shader and texture to render
}
}
is loaded in the constructor, while draw
depends on the completion of loading in the constructor. Consider using Promise
, but it"s a shame that I"m not familiar with Promise
. And I"m not sure if it can be used with webgl
.
if anyone understands and answers, thank you very much!