View Full Version : opengl texture mipmaping produces artifact?

08-15-2010, 08:24 PM
I used a single quad and repeated a single texture to make the ground. When I use mipmapping, there is some (blue)artifact that shows. It doesnt appear when I use GL_NEAREST or GL_LINEAR.


Has anyone encountered this problem before?

08-16-2010, 01:13 AM
I'm not sure if it helps, but is your quad ok? It needs to be 64x64 or 128x128 etc.

08-16-2010, 05:10 AM
the texture file is 512x512. I used the soil library to read the texture and make the mipmap

Rosario Leonardi
08-16-2010, 05:29 AM
I think that your library is adding a fading color to some of the lower level of the mipmap. Can you save the texture (and all mipmap level) in a file and check?
You can also use program like glIntercept (http://glintercept.nutty.org) or the commercial gDebugger to check the textures.

08-16-2010, 05:29 AM
My bet is on a problem with Soil doing the mipmaps.
Try just loading the file through Soil, and not generating the mipmap yet if it is possible.
Then see :
To make OpenGL generate the mipmaps / alternate version is to call glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE ); before glTexImage2D.

If the same artifact appear, then it would be the hardware itself ... what is your video card ?

08-16-2010, 06:26 AM
There is a simple way to see the exact mipmap in your case:
glTextureParameteri(GL_BASE_LEVEL, level_id)
glTextureParameteri(GL_MAX_LEVEL, level_id)

This will force GL to use only LOD level_id. Iterating through those you'll see how correct is Soil with mipmap generation.

08-17-2010, 05:15 AM
Thanks to everyone for all the help! soil is the culprit. I used glGenerateMipmap to make the mipmaps and it produced perfect results.