PDA

View Full Version : Mipmap Borders



MikeM
10-03-2000, 06:09 AM
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

mcraighead
10-03-2000, 06:33 AM
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

MikeM
10-03-2000, 06:51 AM
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