Texturing

Applying textures in OpenGL involves the following steps:

Enable texturing
glEnable(GL_TEXTURE_2D)
 
Define a texture
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height,
             0, GL_RGB, GL_UNSIGNED_BYTE, imageData)
 
Assign texture coordinates
glTexCoord2f(0,0)
glVertex3f(-1.0, -1.0, 0.0)
glTexCoord2f(1,0)
glVertex3f(1.0, -1.0, 0.0)