- #if USE_DEVIL
- ILstring f = strdup(ConvertFileName(fname));
- if (!f)
- {
- return false;
- }
-
- ILuint iid=0;
- ilGenImages(1, &iid);
- ilBindImage(iid);
- if (ilLoadImage(f))
- {
- //iluFlipImage();
- tex.sizeX = ilGetInteger(IL_IMAGE_WIDTH);
- tex.sizeY = ilGetInteger(IL_IMAGE_HEIGHT);
- tex.bpp = ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
- ILuint Bpp = ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL),
- imageSize = tex.sizeX * tex.sizeY * Bpp;
- ILubyte *Data = ilGetData();
- memcpy(tex.data, Data, imageSize);
-
- // Truvision Targa files are stored as BGR colors
- // We want RGB so Blue and Red bytes are switched
- if (IL_TGA == ilGetInteger(IL_IMAGE_FORMAT))
- {
- // Loop Through The Image Data
- for (GLuint i = 0; i < int(imageSize); i += Bpp)
- {
- // Swaps The 1st And 3rd Bytes ('R'ed and 'B'lue)
- GLbyte temp; // Temporary Variable
- temp = tex.data[i]; // Temporarily Store The Value At Image Data 'i'
- tex.data[i] = tex.data[i + 2]; // Set The 1st Byte To The Value Of The 3rd Byte
- tex.data[i + 2] = temp; // Set The 3rd Byte To The Value In 'temp' (1st Byte Value)
- }
- }
- }
- else
- {
- res = false;
- }
- ilDeleteImages(1, &iid);
-/*
- if (tid)
- {
- GLuint texid = ilutGLLoadImage(f);
- *tid = texid;
- }
- else if (mip)
- {
- ilutGLBuildMipmaps()
- }
- else
- {
- ilutGLTexImage(0);
- }
-*/
- free(f);
- #else