PDA

View Full Version : Flickering textures....



Darkpower
08-02-2013, 07:28 PM
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

Nowhere-01
08-02-2013, 10:16 PM
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

GClements
08-03-2013, 04:31 AM
glTexImage2D(....);

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



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).

Darkpower
08-03-2013, 10:22 AM
Wow, it worked, i'm so happy now!! Thanks man, you are my hero Nowhere-01!!

GClements: I'm using OpenGL 4.0 :)