views:

101

answers:

1

After spending hours searching for a simple way to to add an image to an openGL application written in C++, i failed, miserably. It is also apparent that many others have too.

I am fairly new to OpenGL, I have written my own win32 app with OpenGL using DevIL and you guessed it, i failed. The only way i could get DevIL to work was using Glut, which i dont want to use, or SDL or glaux.h

What i am looking for is code or a tutorial for a simple image loader in C++ with OpenGL and DevIL, Any help would be greatly appreciated.

A: 

If you're asking OpenGL to filter using mapmaps make sure to give it mipmaps to filter with.

Also, I'm pretty sure glTexParameteri() and glTexEnvf() only apply to the currently bound texture.

Try replacing your InitTextures() with this:

Tex1 = ilutGLLoadImage("tex1.bmp");
glBindTexture( GL_TEXTURE_2D, Tex1 );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

Tex2 = ilutGLLoadImage("tex2.bmp");
glBindTexture( GL_TEXTURE_2D, Tex2 );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
genpfault
The code from pastebin works fine with glut, I want to replicate that code as a win32 app with opengl, not using glut.Im really at a loss of how to go about it, all the tutorials i have seen include glut or ones like NeHes tutorials which use the glaux lib.http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06I want to swap out the glaux lib functions in that tutorial for the DevIL lib, But im not sure how to go about it as i do not have a proper understanding of DevIL? Is it possible?
Jeraldo