I found the error
I did a search for the the rendering function that I use, at it seems to be collected from http://nehe.gamedev.net/tutorials/lesson.asp?l=06
I also discovered my error here - I should use images with height and width that are power of 2 (64, 256…).
That’s a bit cumbersome, I think…How can I go about this?
These are the functions that I use:
/******************************************/
// Loads a bitmap image
AUX_RGBImageRec *LoadBMP(char *Filename)
{
// File handler
FILE *File=NULL;
// Make shure a file name was given
if (!Filename)
{
return NULL;
}
// Check to see if the file exists
File=fopen(Filename,“r”);
// Make shure the file was loaded
if (File)
{
fclose(File);
// Load the bitmap and return a pointer
return auxDIBImageLoad(Filename);
}
// if load failed return null
return NULL;
}
// Load bitmap and convert to texture - height and width MUST be power of 2 (64,128,256…)
LoadGLTextures(char * fname)
{
// Status indicator
int Status=FALSE;
// Create storage space for the texture
AUX_RGBImageRec *TextureImage[1];
// Set the pointer to NULL
memset(TextureImage,0,sizeof(void *)*1);
// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
if (TextureImage[0]=LoadBMP(fname))
{
Status=TRUE;
// Create the texture
glGenTextures(2, &texture[0]);
// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, texture[0]);
// Generate The Texture
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
// Linear filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
// Linear filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
// If texture exists
if (TextureImage[0])
{
// If texture image exists
if (TextureImage[0]->data)
{
// Free the image memory
free(TextureImage[0]->data);
}
// Free the image structure
free(TextureImage[0]);
}
return Status;
}
/*******************************************/