Flickering textures....

Hi!

I have a problem with my terrain and that is; the textures is flickering(Like tv noise*) when the “camera” is further away from the terrain and when viewing it in close-up the flickering dissapears, why’s that? How can I solve it?

Video(watch in HD!): https://www.youtube.com/watch?v=yLiN0bfXRYU

*Tv noise:
http://cdn1.cdnme.se/cdn/9-2/613587/images/2009/tv_51042408.jpg

Thanks
Daniel

try enabling MipMapping:


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

glTexImage2D(....);

glGenerateMipmap(GL_TEXTURE_2D); //should go after you specified texture image

http://en.wikipedia.org/wiki/Mipmap

glGenerateMipmap() requires OpenGL 3.0. If you need the code to work with earlier versions, replace glTexImage2D() with gluBuild2DMipmaps() or gluBuild2DMipmapLevels() (the latter requires GLU 1.3).

Wow, it worked, i’m so happy now!! Thanks man, you are my hero Nowhere-01!!

GClements: I’m using OpenGL 4.0 :slight_smile: