/* function to load in bitmap as a GL texture */ int LoadGLTextures( ) { /* Status indicator */ int Status = false; /* Create storage space for the texture */ SDL_Surface *TextureImage[1]; // Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit /*if ( ( TextureImage[0] = SDL_LoadBMP( "KillaKill.bmp" ) ) )*/ if ( ( TextureImage[0] = IMG_Load( "image.png" ) ) ) { /* Set the status to true */ Status = true; /* Create The Texture */ glGenTextures( 1, &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]->w, TextureImage[0]->h, 0, GL_BGR, GL_UNSIGNED_BYTE, TextureImage[0]->pixels ); /* Linear Filtering */ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); } // Free up any memory we may have used if ( TextureImage[0] ) SDL_FreeSurface( TextureImage[0] ); return Status; }