2.2: Adding Some Texture
This time we are adding a texture to the triangle. We'll have to add two main pieces of data: texture coordinates and texture data. Texture coordinates are the same as vertex positions in that they may be described in 4 dimensions. When we talk about a position (coordinate) on the texture itself, the vectors are named s, t, r, and q. An alternative naming convention is to use u, v, w in place of s, t, and r. I believe the fourth vector is sometimes called x instead of q, (but don't quote me on that). Also, to complicate the naming convention further, GLSL does not use r, but p for the third vector because r is already taken by red in rgba. All that to say that GLSL texture coordinates are named s, t, p, and q, but OpenGL names them s, t, r, and q. Yes, yet another OpenGL inconsistency that can get a little confusing if you don't know about it. Adding a texture is going to take several steps--far more non-trivial than adding color. ...