Prerequisites for texture drawing
Implementing textures is easy and requires only a few steps. Let's have a quick overview of this first, then we will take a deep dive into it:
- Texture coordinates: Textures are glued to the geometry surfaces using texture coordinates. For each vertex, there is a corresponding texture coordinate attached. In our implementation, we specified the vertices and texture coordinates in an interleaved form.
- The shader stage: The vertex and fragment shader are modified to bound the texture resources. The shader stage allows the fragment shader to access the texture resource and paint the fragments. Textures are shared in the form of a sampler at the shader stage.
- Loading the image files: Parse the image files and load the ...