I have finally gotten OpenGL to recognize importing my bitmaps to some extent. The problem now is that it is completely screwing them up. For example, the image to be imported (left) comes out as (right):
Here is the relevant code:
int paint()
{
//InitGL();
//glTranslatef(0, 0,-5.0f);
glEnable(GL_TEXTURE_2D);
//draw a square with specified texture coordinates
double xvals[] = {cur_x_cross, cur_x_cross + 10, cur_x_cross + 10, cur_x_cross};
double yvals[] = {cur_y_cross, cur_y_cross, cur_y_cross + 10, cur_y_cross + 10};
float svals[] = {0.0f, 0.0f, 1.0f, 1.0f};
float tvals[] = {1.0f, 0.0f, 0.0f, 1.0f};
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(cur_x_cross, cur_y_cross,0);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(cur_x_cross + 30, cur_y_cross,0);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(cur_x_cross + 30, cur_y_cross + 30,0);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(cur_x_cross, cur_y_cross + 30,0);
/*for (int i=0; i < 4; i++)
{
glTexCoord2f(svals[i], tvals[i]);
glVertex2f(xvals[i], yvals[i]);
}*/
glEnd();
glDisable(GL_TEXTURE_2D);
//glFlush();
glutSwapBuffers();
return TRUE;
}
void LoadBitmap(UINT textureArray[], LPSTR strFileName, int ID)
{
if(!strFileName) return;
AUX_RGBImageRec *pBitMap = auxDIBImageLoad(strFileName);
glGenTextures(1, &textureArray[ID]);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitMap->sizeX, pBitMap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitMap->data);
}
int InitGL(GLvoid)
{
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glEnable(GL_TEXTURE_2D);
LoadBitmap(TextureArray, "untitled.bmp", 0);
return TRUE;
}