mimap level error

got some problem …texture no showing up.
i tried mipmap levels and changed filter settings. but still undenfined !! :confused: help!



glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );


Please, post some more information/code. How do you render your object?

When you ask for mipmaps in MIN filter, you have to provide each mipmap level with glTexImage2D or use it automatically with one of these methods :
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); // GL 1.4, deprecated in GL3.0 : generate mipmaps each time glTexImage2D changes the base level
glGenerateMipmap(GL_TEXTURE_2D); // for GL3.0+ : when called, generates mipmaps from base level, once

I personally use gluBuild2DMipmaps. Even if many people here will say we shouldn’t use glu… This is easy and simple.

After, from what ZbuffeR said, we should ensure gluBuild2DMipmaps will behave correctly depending on the GL version it is running on…

No need to worry, because gluBuild makes the mipmaps by hand on the cpu, and uploads each level with glTexImage2D. Bigger problem though : it will convert NPOT to POT texture silently, so be careful.

This is how i create texture environment


glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, IMG_WIDTH, IMG_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);

This is how i setup texture…


glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, teximage);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, IMG_WIDTH, IMG_HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, texture );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );

many thanks…

First, try with GL_TEXTURE_MIN_FILTER, GL_LINEAR and no gluBuild2DMipmaps, to eliminate any problem with mipmaps. If texture stil has problem, then check you have correct data in *texture : size, values, …