Mipmap Borders

The application I’m working on needs to make provisions for user machines with Voodoo 3 cards (and their 256x256 pixel texture limit). I have large textures (ex: 2048x2048) which I run through some tiling code to get 64 tiles of 256x256 pixels each. Then I texture an 8x8 array of quads to reconstruct the original image.

The problem is that I want to auto-create mipmaps and use the filter GL_LINEAR_MIPMAP_NEAREST to avoid the blocky pixelation when up close, but I also want to use borders to ensure the seams between quads are invisible. The problem is that although the function glTexImage2D() has a provision for specifying the border width, the function gluBuild2DMipmaps() does not.

Am I stuck building the mipmap levels manually if I want each mipmap level to use a 1 pixel border?

Thanks in advance for any help can provide!

MikeM

You probably don’t actually want to use texture borders; they’re one of the worst-supported OpenGL features.

Tiling a large texture into a bunch of smaller ones is a tricky problem without texture borders, though. One option is to treat a 256x256 texture as a 254x254 texture with a 1-pixel border, and to use CLAMP_TO_EDGE as your wrap mode. This isn’t particularly appealing either, though.

If you do use borders, watch out. When you’re creating your mipmaps, you don’t want to average 2 pixels in the border to get 1 pixel in the next level of the border. There are actually 2 pixels further out on your original (large) texture that you also want to sample in.

Also watch out, because borders may or may not be accelerated. If they’re not accelerated on the V3, you’ll almost certainly have to find a different option. Most of the non-border options involve image quality degradation.

  • Matt

Matt,

Thanks for the warning. Although I’d like to get rid of the seam artifacts, they are definitely not show-stoppers. Appreciate your help.

MikeM