diff options
author | Matěj Týč <bubla@users.sourceforge.net> | 2009-02-06 17:59:22 +0000 |
---|---|---|
committer | Matěj Týč <bubla@users.sourceforge.net> | 2009-02-06 17:59:22 +0000 |
commit | fb3bfeacad1235d1614a200e26fc1d90525a9279 (patch) | |
tree | 7ba2ae9f137816ccd017b36bd4f1bb47a5135b1e /DevIL/examples | |
parent | dc2b0dd444c2cf015356feae7d2bd31cde7bf458 (diff) | |
download | devil-fb3bfeacad1235d1614a200e26fc1d90525a9279.tar.gz |
reduced dependency of simple examples and testil on ILU
Diffstat (limited to 'DevIL/examples')
-rw-r--r-- | DevIL/examples/Makefile.am | 31 | ||||
-rw-r--r-- | DevIL/examples/override_example/iotest.c | 20 | ||||
-rw-r--r-- | DevIL/examples/register_read_example/readtest.c | 19 | ||||
-rw-r--r-- | DevIL/examples/simple_example/simple.c | 22 |
4 files changed, 62 insertions, 30 deletions
diff --git a/DevIL/examples/Makefile.am b/DevIL/examples/Makefile.am index 248e46ed..2aace159 100644 --- a/DevIL/examples/Makefile.am +++ b/DevIL/examples/Makefile.am @@ -5,17 +5,17 @@ examplesdir = $(devildir)/examples AM_CPPFLAGS = -I $(all_include) if BUILD_MONOLITHIC -#il_library = ../lib/libDevIL.la # just not needed now +il_library = ../lib/libDevIL.la ilu_library = ../lib/libDevIL.la ilut_library = ../lib/libDevIL.la else #NOT BUILD_MONOLITHIC -#il_library = ../lib/libIL.la # just not needed now +il_library = ../lib/libIL.la ilu_library = ../lib/libILU.la ilut_library = ../lib/libILUT.la endif #BUILD_MONOLITHIC EXTRA_DIST = -examples_PROGRAMS = +examples_PROGRAMS = IL_override IL_read IL_simple if BUILD_ILUT @@ -45,12 +45,6 @@ endif #HAVE_GLUT endif #BUILD_ILUT -if BUILD_ILU - -examples_PROGRAMS += ILU_override ILU_read ILU_simple - -endif #BUILD_ILU - ILUT_allegro_SOURCES = allegro_example/allegtest.c ILUT_allegro_CFLAGS = $(alleg_CFLAGS) ILUT_allegro_LDFLAGS = $(ilut_library) @@ -70,17 +64,24 @@ ILUT_d3d_LDFLAGS = $(ilut_library) ILUT_cpp_wrapper_SOURCES = cpp_wrapper_example/il_wrap.cpp ILUT_cpp_wrapper_LDFLAGS = $(ilut_library) -ILU_override_SOURCES = override_example/iotest.c -ILU_override_LDFLAGS = $(ilu_library) +IL_override_SOURCES = override_example/iotest.c ILUT_gl_SOURCES = opengl_example/gltest.c opengl_example/gltest.h ILUT_gl_LDFLAGS = $(ilut_library) -ILU_read_SOURCES = register_read_example/readtest.c -ILU_read_LDFLAGS = $(ilu_library) +IL_read_SOURCES = register_read_example/readtest.c + +IL_simple_SOURCES = simple_example/simple.c -ILU_simple_SOURCES = simple_example/simple.c -ILU_simple_LDFLAGS = $(ilu_library) +if BUILD_ILU +IL_override_LDFLAGS = $(ilu_library) +IL_read_LDFLAGS = $(ilu_library) +IL_simple_LDFLAGS = $(ilu_library) +else #not BUILD_ILU +IL_override_LDFLAGS = $(il_library) +IL_read_LDFLAGS = $(il_library) +IL_simple_LDFLAGS = $(il_library) +endif #not BUILD_ILU ILUT_volume_SOURCES = volume_example/3dtest.h volume_example/3dtest.c ILUT_volume_LDFLAGS = $(ilut_library) diff --git a/DevIL/examples/override_example/iotest.c b/DevIL/examples/override_example/iotest.c index 0db8f162..460ae7bc 100644 --- a/DevIL/examples/override_example/iotest.c +++ b/DevIL/examples/override_example/iotest.c @@ -12,11 +12,21 @@ //----------------------------------------------------------------------------- // Required include files. -#include <IL/il.h> -#include <IL/ilu.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ +#include <IL/il.h> #include <stdio.h> +/* We would need ILU just because of iluErrorString() function... */ +/* So make it possible for both with and without ILU! */ +#ifdef ILU_ENABLED +#include <IL/ilu.h> +#define PRINT_ERROR_MACRO printf("Error: %s\n", iluErrorString(Error)) +#else /* not ILU_ENABLED */ +#define PRINT_ERROR_MACRO printf("Error: 0x%X\n", (unsigned int)Error) +#endif /* not ILU_ENABLED */ ILHANDLE ILAPIENTRY iOpenRead(const char *FileName) { @@ -100,8 +110,7 @@ int main(int argc, char **argv) } // Check if the shared lib's version matches the executable's version. - if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || - iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION) { printf("DevIL version is different...exiting!\n"); return 2; } @@ -150,8 +159,7 @@ int main(int argc, char **argv) // Simple Error detection loop that displays the Error to the user in a human-readable form. while ((Error = ilGetError())) { - printf("Error: %s\n", iluErrorString(Error)); - } + PRINT_ERROR_MACRO;} return 0; } diff --git a/DevIL/examples/register_read_example/readtest.c b/DevIL/examples/register_read_example/readtest.c index b24113b1..a149008f 100644 --- a/DevIL/examples/register_read_example/readtest.c +++ b/DevIL/examples/register_read_example/readtest.c @@ -12,10 +12,22 @@ //----------------------------------------------------------------------------- // Required include files. +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + #include <IL/il.h> -#include <IL/ilu.h> #include <stdio.h> +/* We would need ILU just because of iluErrorString() function... */ +/* So make it possible for both with and without ILU! */ +#ifdef ILU_ENABLED +#include <IL/ilu.h> +#define PRINT_ERROR_MACRO printf("Error: %s\n", iluErrorString(Error)) +#else /* not ILU_ENABLED */ +#define PRINT_ERROR_MACRO printf("Error: 0x%X\n", (unsigned int)Error) +#endif /* not ILU_ENABLED */ + ILboolean ILAPIENTRY LoadFunction(const char *FileName) { ILuint Width, Height; @@ -53,8 +65,7 @@ int main(int argc, char **argv) } // Check if the shared lib's version matches the executable's version. - if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || - iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION) { printf("DevIL version is different...exiting!\n"); return 2; } @@ -101,7 +112,7 @@ int main(int argc, char **argv) // Simple Error detection loop that displays the Error to the user in a human-readable form. while ((Error = ilGetError())) { - printf("Error: %s\n", iluErrorString(Error)); + PRINT_ERROR_MACRO; } return 0; diff --git a/DevIL/examples/simple_example/simple.c b/DevIL/examples/simple_example/simple.c index 77061573..fb1d9752 100644 --- a/DevIL/examples/simple_example/simple.c +++ b/DevIL/examples/simple_example/simple.c @@ -13,10 +13,22 @@ //----------------------------------------------------------------------------- // Required include files. +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + #include <IL/il.h> -#include <IL/ilu.h> #include <stdio.h> +/* We would need ILU just because of iluErrorString() function... */ +/* So make it possible for both with and without ILU! */ +#ifdef ILU_ENABLED +#include <IL/ilu.h> +#define PRINT_ERROR_MACRO printf("Error: %s\n", iluErrorString(Error)) +#else /* not ILU_ENABLED */ +#define PRINT_ERROR_MACRO printf("Error: 0x%X\n", (unsigned int)Error) +#endif /* not ILU_ENABLED */ + int main(int argc, char **argv) { ILuint ImgId; @@ -31,15 +43,16 @@ int main(int argc, char **argv) } // Check if the shared lib's version matches the executable's version. - if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION || - iluGetInteger(ILU_VERSION_NUM) < ILU_VERSION) { + if (ilGetInteger(IL_VERSION_NUM) < IL_VERSION) { printf("DevIL version is different...exiting!\n"); return 2; } // Initialize DevIL. ilInit(); +#ifdef ILU_ENABLED iluInit(); +#endif // Generate the main image name to use. ilGenImages(1, &ImgId); @@ -74,8 +87,7 @@ int main(int argc, char **argv) // Simple Error detection loop that displays the Error to the user in a human-readable form. while ((Error = ilGetError())) { - printf("Error: %s\n", iluErrorString(Error)); - } + PRINT_ERROR_MACRO;} return 0; |