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, IMAGE_WIDTH, IMAGE_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, textureImage); |
Assigned texture coordinates | glTexCoord2i(0,0); glVertex3f(-1.0, -1.0, 0.0); glTexCoord2i(1,0); glVertex3f(1.0, -1.0, 0.0); |