Jump to content
  • Advertisement
Sign in to follow this  
knobby67

loading diffrent images onto opengl

This topic is 4518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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] ); }

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!