   Problems with TGA textures...
  Hi,I´m using the CTargaImage class given in the Beginning OpenGL book to handle my tga texture, but my programs seems to work fine just with the textures of tutorials of the net.The textures are loaded correcly but right after I finish my app I get a error.Why´s that? How can I know if a particular texture downloaded from net has an alpha channel or what´s his store data type? I´m going crazy with that, maybe I´m just making a stupid mistake.Here is a snippet of the code:    glEnable( GL_TEXTURE_2D );   texture = new CTargaImage;   if (! texture->Load("rock.tga") ) return false;   glGenTextures( 1 , &texture_id );   // bind the texture object    glBindTexture(GL_TEXTURE_2D, texture_id );   // minimum required to set the min and mag texture filters    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);   // now that the texture object is bound, specify a texture for it    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB , texture->GetWidth(),  texture->GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE,   texture->GetImage());
  You've called glTexImage2D () with GL_RGB without knowing exactly what your texture type is. Either you modify your texture loading routine to return the texture type or use a fixed texture internal format. But most of the time the texture will be stored in type GL_RGBA, so repair your texture loading routine is probably better.What was the error you have got ?.You may try IrfanView for a free image viewer. For files format you can take a look at Wotsit.   ;Quote:Original post by Skeleton_V@TYou've called glTexImage2D () with GL_RGB without knowing exactly what your texture type is ...I think you're right, but anytime I used incompatible image formats in TexImage the program crashed outright.Himura-San, check whether your TGA class has a returnImageFormat() or something method, and choose OGL's texture internalfmt accordingly. But as I wrote above, I have a little doubt that that's the problem for rock.tga, what is exactly the error you are talking about?   ;  First of all, thanks for your attention.Skeleton, thank you for the IrfanView tip, It´s marvelous. :DWell , I´ve changed my glTexImage2D(...) to this and i still get the same error:// now that the texture object is bound, specify a texture for itglTexImage2D(GL_TEXTURE_2D, 0, texture->GetBPP() / 8 ,    texture->GetWidth(), texture->GetHeight(), 0,   texture->GetBPP() == 32 ? GL_RGBA : GL_RGB,    GL_UNSIGNED_BYTE,    texture->GetImage() );My app is working perfectly , the texture loads and all other stuff goes well.The problem is right after I close it. I get that WindowsXP error about illegal operation just like when you handle pointers the first time.I´ve rock.tga and wall.tga. Although they have the very same properties when I use rock.tga I don´t get the error but with wall.tga I do.Thanks in Advance.   ;  try to clean up the texture (CTargaImage). (delete)   ;  This might be a long shot, but the images are power-of-2, aren't they?   ;  If you're getting page faults, then your stack is either becoming corrupt, or you're accessing invalid pointers, so check for those. Strewing a load of _ASSERTE( _CrtCheckMemory() ) calls around wouldn't go a miss either (include crtdbg.h - and make sure you're running in debug mode). I presume you've tried the debugger to trace the source of the error?   ;  Hey guys, it was just a pro with the clean up :DI created a new projetc in GLUT to test and it worked nice.I´m using wxWidgets as GUI and I still dont get what´s wrong in my destructor class, but I will find out now that I know the problem is in the deleting process.Probably an invalid pointer...Thank You Python for the tips. I´m still a noob on debugging but I will sure follow your advise.Thank you guys.[Edited by - Himura-San on January 11, 2006 6:20:11 AM]