devIL and OpenGL

Recommended Posts

Can I just replace the: (TextureImage[0]=LoadBMP("Data/Ocean.bmp")) in Nehe's basecode to use devILs image loading like below: (TextureImage[0]=ilLoad(IL_PNG, "Ocean.png"); and not have to worry about changing anything else in my program? If so, can anyone tell me how to get devIL up and running on Dev C++, all the tutorials I have found are for MSDEVC++.

Share on other sites
In NeHe tutorial 6, TextureImage[0] is defined like this:

AUX_RGBImageRec *TextureImage[1];

So it will almost certainly not work with out changing this definition. Also you will most likely have to change this line:

glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);

Because Png data is stored differently - notably it usually has as alpha component.

Share on other sites
I hope that this will help you.
// init DevILilInit();iluInit();ilutRenderer(ILUT_OPENGL);ilutInit();

then to load a texture
unsigned int id = ilutGLLoadImage(strFile);

After this you are ready to bind id using glBindTexture()

Share on other sites
You are using DevC++, well apparently DevC++ does not have an official release and is also not supported officially. However bcos Ogre uses Devil as well, some users of Ogre had come up with a DevC++ DevPak which contained pre-compiled dlls/.a files for DevC++. Unfortunately the DevPak link is down and you will have to ask for it in Devil's forums. Ill try to look for it and post a link here if i can locate it.

Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• Forum Statistics

• Total Topics
628307
• Total Posts
2981972

• 9
• 13
• 11
• 12
• 11