I have problems with reading an image with DevIL 1.7.8. So far I know the following snippet should work:
ilInit();
ILuint ImageName;
ilGenImages(1, &ImageName);
ilBindImage(ImageName);
wchar_t* imgFilename = L"..\\..\\resources\\textures\\red.png";
ilLoadImage(imgFilename);
ILubyte* texture = ilGetData();
When I check the first pixels
for (int i=0; i<64; i++) cout << (int)texture[i] << endl;
I get a pretty random output. The picture is actually completely red.
As well I tried using ilut
ilutRenderer(ILUT_OPENGL);
GLuint t = ilutGLLoadImage(L"..\\..\\resources\\textures\\red.png");
But actually I can't even include the corresponding header file because within that header file il.h is linked which is supposed to be in a folder (\IL) that does not exist. Even when I create this folder and copy the needed header files into it I get compile errors.
Can anybody help me with DevIL?
I am reading image and binding textures like this:
When rendering, you need to bind the correct texture first:
And then assign UV coordites of texture to vertexes:
Do not forget to enable GL_TEXTURE_2D or whatever type you are using.