Сабж: Как загружать текстуру из SDL_image версии 2.0 формата PNG или любого другого формата отличающего от bitmap ?!
P.S c BMP всё просто SDL_LoadBMP( "KillaKill.bmp" )
а вот с PNG или с другими форматами
/*BITMAP*/
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" ) ) )
{
/* 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;
}