Original Post
I'm trying to figure out why the textures on my .obj model don't load when I load the model into opengl. I'm using a .obj loader written by Karl Berg. And here are the spots that display error messages. First one is here..
if (memcmp(RAW_Header, TGAcompare, sizeof(TGAcompare)) == 0)
fType = 0;
else if (memcmp(CMP_Header, TGAcompare, sizeof(TGAcompare)) == 0)
fType = 1;
else
{
printf("error, invalid formatTGA2!\n");
fclose(in_file);
return false;
} and if I comment out the fail command the next error I get is here.. texture.width = header[1] * 256 + header[0];
texture.height = header[3] * 256 + header[2];
texture.bpp = header[4];
if (texture.width <= 0 || texture.height <= 0 || (texture.bpp != 24 && texture.bpp != 32))
{
printf("error, invalid formatWidth!\n");
fclose(in_file);
return false;
} Now I'm pretty sure the second snippet is telling me that my textures are not the right size? they should be 256x256? But what I don't understand is why the first snippet is giving a fail message? What exactly does that part of code check for in a texture file? Thanks.