Texture images are represented using objects in a fashion very similar to buffer objects. We can create an arbitrary number of them, but only one of them is bound at any moment.
The actual use of textures begins with a bit of ceremony. An image origin is at the upper-left, but a texture origin is at the lower-left. To account for this, configure the GL to flip all image inputs along the Y axis.
Creating a texture object is familiar.
Image is requested via the network. We must await its arrival and fill the texture object with data only after it arrives.
src triggers the request.
When the image arrives, the
onload function is invoked. It initialized the texture object using the
Image as follows.
texParameteri functions will be explained soon.