Strange red artifacts

I’m getting some very strange red artifacts appearing on distant parts of the terrain and down the trunks of my trees.
Has anyone ever experienced an effect like this:

On trees:

http://vault101.co.uk/downloads/redline1.jpg

On trees and terrain:

http://vault101.co.uk/downloads/redline2.jpg

I can’t understand what’s causing it - I’ve cut the rendering loop down the bare minimum and this is still appearing.



mainloop ()
{
gl.glClear (gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
gl.glEnable (gl.GL_TEXTURE_2D);
gl.glPolygonMode (gl.GL_FRONT_AND_BACK, gl.GL_FILL);
gl.glLoadIdentity ();
glu.gluLookAt ( .... camera position, view, up vector);

drawSkyBox();
drawTerrain();
drawTrees();
}

drawSkyBox()
{
    gl.glBindTexture (gl.GL_TEXTURE_2D, texture[north]);
    // draw a quad 
    gl.glBindTexture (gl.GL_TEXTURE_2D, texture[south]);
   // draw a quad 
   //  etc
}

drawTerrain()
{
gl.glActiveTextureARB (gl.GL_TEXTURE0_ARB)
gl.glEnable (gl.GL_TEXTURE_2D);
 // bind terrain texture

gl.glActiveTextureARB (gl.GL_TEXTURE1_ARB);
gl.glEnable (gl.GL_TEXTURE_2D);
gl.glTexEnvi (gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_COMBINE_ARB);
gl.glTexEnvf (gl.GL_TEXTURE_ENV, gl.GL_RGB_SCALE_ARB, 1); // gamma

// bind detail texture

 // draw triangle strips

 gl.glActiveTextureARB (gl.GL_TEXTURE1_ARB);
gl.glDisable (gl.GL_TEXTURE_2D);
        
gl.glActiveTextureARB (gl.GL_TEXTURE0_ARB);
gl.glDisable (gl.GL_TEXTURE_2D);

}

drawTrees()
{
 // bind texture
 // draw verts
}

There’s one or two other things in there such as figuring out height and other game stuff but nothing at all about changing any colours or binding to any reddish texture.

Any ideas?

The default mipmap code (glu) sometimes shows extremly tiny mipmaps with red pixels.

Don’t ask me why…

Ah, ok. I just stripped out everything, no trees, nothing and drew a 3x3 tile terrain with no fancy stuff and when I backed away from it and viewed it at certain angles I still saw some red speckles. Well I’ll need to consider turning off mipmapping for certain objects then.

Better would be to calculate proper mipmaps yourself, if glu’s mipmaps are causing problems. In fact glu’s mipmaps are pretty bad anyway - they just use a standard box filter which is about as simple and crude as you can get. Hunt around a bit and you’ll find lots of better minification filters that you could use instead.

Good plan - it’s not too much of an issue just now but I’ll need to clean it up later!
Thanks for the tip!