🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

loading diffrent images onto opengl

Started by
1 comment, last by lc_overlord 18 years ago
Hello I'm hoping some one can help me out with this i'm using a bit of code from the nehe examples to load various image types (using SDL image) the code complies OK but I get an error for everytype of image apart from bitmaps can anyone help, my code is void LoadTexture(const char *imagemap,GLuint *image) { SDL_Surface *TextureImage[1]; TextureImage[0] = IMG_Load(imagemap); /*bind it to slow image*/ glGenTextures( 1, &(*image)); glBindTexture( GL_TEXTURE_2D, *image); /* Generate The Texture */ /* Mipmapped Filtering */ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); /* Generate The MipMapped Texture */ gluBuild2DMipmaps( GL_TEXTURE_2D, 3, TextureImage[0]->w, TextureImage[0]->h, GL_BGR, GL_UNSIGNED_BYTE, TextureImage[0]->pixels ); /* Free up any memory we may have used */ if ( TextureImage[0] ) SDL_FreeSurface( TextureImage[0] ); }
Advertisement
Apologies it does work, but I was trying about 15 diffrent types of image, I tried a few which didn't work. However all the standrads do bmp tga etc.

Sorry admin
to get the others to work you have to have the varius libraries installed acording to this.
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fimage

This topic is closed to new replies.

Advertisement