Floating point texture extensions and mipmapping

There is a question to all of this but first the background.

I’ve been working on doing some image processing using GLSL and openGL to set up some data to pass to CUDA. Part of that involved building an image pyramid so rather than write out an actual set of gaussian pyramid shaders I decided to be lazy and just use mipmapping to build the pyramid for me. I was also rendering to an FBO for everything.

Hardware set up. 8800GTS on linux.

Also, I am/was using GL_LUMINANCE32F_ARB as my internal texture format. So I run my shader program and render out to the the first level of the mipmap texture. I then called glGenerateMipmapEXT and tested the mipmap by drawing a series of smaller quads with GL_NEAREST_MIPMAP_LINEAR set to make sure the chain was set up fine and it was. I also ran a fragment shader with an LoD bias set to display each mipmap level stretched out to the original size to make sure everything looked ok visually and it did. However, when I ran a glGetTexImage to check the data in each of the levels of the pyramid I ran into a few problems…

  1. I was getting a smallish number(300 to 1500) of NaN’s out at some levels.

  2. I was getting large negative values when the data in the texture base level was entirely positive

  3. Sometimes the entire level came out as all zeros.

I eventually solved my problem by writing my own box filter shader and rendered out each level of the mipmap directly with an FBO, which seemed to work fine.

So the official question…

was I just being entirely dumb in some subtle yet important way…(rendering to the FBO went fine and then I just called glGenerateMipmapEXT after

OR…

do glGenerateMipmapEXT and GL_LUMINANCE32F_ARB(and other such floating point extensions) not play nice …

OR…

does glGenerateMipmapEXT simply not populate the the mipmap chain in the case of the floats but rather keeps some sort of internal pointer structure or something that it slips in during calls to the mipmap levels…

This has just been bugging me now that I’ve got something working but it was driving me nutty for a day or two.

Cheers.