You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
876 B
47 lines
876 B
#include <stdlib.h>
|
|
#include <il.h>
|
|
#include <ilu.h>
|
|
#include "paa.h"
|
|
#include "il_paa.h"
|
|
|
|
// helper macros
|
|
#define PRINTF_DEVIL_ERROR(msg) { \
|
|
devilError = ilGetError(); \
|
|
if (devilError != IL_NO_ERROR) { \
|
|
printf("%s: %s\n", (msg), iluErrorString(devilError)); \
|
|
exit(2); \
|
|
} \
|
|
}
|
|
|
|
// global variables
|
|
ILenum devilError;
|
|
|
|
static inline void Init(void)
|
|
{
|
|
ilInit();
|
|
PRINTF_DEVIL_ERROR("DevIL Error (ilInit)")
|
|
|
|
iluInit();
|
|
PRINTF_DEVIL_ERROR("DevIL Error (iluInit)")
|
|
}
|
|
|
|
ILuint LoadFile(ILconst_string File)
|
|
{
|
|
ILuint Image = iluLoadImage(File);
|
|
PRINTF_DEVIL_ERROR("Error while loading file")
|
|
|
|
return Image;
|
|
}
|
|
|
|
bool ConvertTexture(const char* InFile, const char* OutFile)
|
|
{
|
|
Init();
|
|
il_paa_init();
|
|
|
|
LoadFile(InFile);
|
|
|
|
ilSaveImage(OutFile);
|
|
PRINTF_DEVIL_ERROR("Error while saving file")
|
|
|
|
return true;
|
|
}
|
|
|