Anonymous - 2011-07-05

I don't know how its done in visual studio 2010
because i use Code::Blocks
here is how i would set it up.

Linker:
DevIL
ilu
ilut

Includes:
#include <il/il.h>
#include <il/ilu.h>
#include <il/ilut.h>
/// That is how i have my devil lib set up

and before i make any calls to devIL function
you must first call:

ilInit();
iluInit();
ilutRenderer(ILUT_OPENGL);

here is an example code for loading a png file
with devil.
---------------------------------------------
string filename = "NeedToLoad.png";
ILuint ilTexture;
unsigned int texID;
ilGenImages(1, &ilTexture);
ilBindImage(ilTexture);

if (!ilLoadImage((const char*)filename.data()))
{
const char *ret = iluErrorString(ilGetError());
fprintf(stdout,"fail Load ret = %s\n",ret);
}
if(ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE))
{

width = ilGetInteger(IL_IMAGE_WIDTH);
height = ilGetInteger(IL_IMAGE_HEIGHT);
glGenTextures(1, &texID);
glBindTexture(GL_TEXTURE_2D, texID);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);// NULLed 6.15.2011 GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);//GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
format = ilGetInteger(IL_IMAGE_FORMAT);
glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), width, height, 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData());
}else
{
fprintf(stdout,"failed\n");
}
ilDeleteImages(1, &ilTexture);
--------------------------------------------------
if you have any more questions just ask
Ive been using sdl with openIL for a while now, currently developing a game engine with a GUI based IDE for Users->Noobs();

Comment->Later("C Ya\n");

 
Last edit: Anonymous 2013-11-26