Here’s my texturing code that goes along with my problem (obviously this isn’t 100% complete due to a lack of class definitions and such, but those should be pretty self-explanitory)
Image loading:
ilInit();
ilutInit();
ilutRenderer(ILUT_OPENGL);
ilGenImages(1, &this->image_name);
ilBindImage(this->image_name);
ilLoadImage(filename);
ILuint Width = ilGetInteger(IL_IMAGE_WIDTH);
ILuint Height = ilGetInteger(IL_IMAGE_HEIGHT);
ILubyte *Data = ilGetData();
glGenTextures(1, &this->texture);
glBindTexture(GL_TEXTURE_2D, this->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, Data);
ilDeleteImages(1, &image_name);
Drawing:
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, this->texture);
glTexCoord2f(0.0, 0.0);
glVertex3d(this->verts[0].x, this->verts[0].y, this->verts[0].z); // bottom left corner
glTexCoord2f(1.0, 0.0);
glVertex3d(this->verts[1].x, this->verts[1].y, this->verts[1].z); // bottom right corner
glTexCoord2f(1.0, 1.0);
glVertex3d(this->verts[2].x, this->verts[2].y, this->verts[2].z); // top right corner
glTexCoord2f(0.0, 1.0);
glVertex3d(this->verts[3].x, this->verts[3].y, this->verts[3].z); // top left corner