This topic is now archived and is closed to further replies.

Terrain Flickering

This topic is 5375 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, If you could point me in the right direction, I would appreciate it. As I move around the terrain, the texture flickers (even with the lights off) The only thing I can think of is that its related somehow to the depth testing or the mipmapping (but I also try without mipmapping and it does the same thing)And it flickers no mateer what distance I am from the terrain, but only when it moves. Here are the relevant lines: glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); at each frame I: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); and I load the texture both ways: if (mip==0){ glTexImage2D(GL_TEXTURE_2D, 0, 3, Image->sizeX, Image->sizeY,0, GL_RGB, GL_UNSIGNED_BYTE, Image->data); }else{ gluBuild2DMipmaps(GL_TEXTURE_2D, 3, Image->sizeX, Image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, Image->data); } with glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,FilterTypeNear); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,FilterTypeFar); where I have tried differents parameters eg GL_LINEAR, GL_NEAREST, GL_LINEAR_MIPMAP_LINEAR thanx

Share this post

Link to post
Share on other sites
Pretty much as in the nehe tutorials



float fovy=45.0;
float znear=0.1f;
float zfar=5000.0f; ( large, I know....)


Share this post

Link to post
Share on other sites

I changed the zfar to 1000 but it still does it.

I should add (I have just discovered this) that the flickering
is not as bad if I move in the -x direction, but is equally bad if I move in the +x,+z,-z directions.......

Share this post

Link to post
Share on other sites