FBO and manual mipmap generation

Hey all,

I currently have my RTT (using FBO) generating mipmaps but I need a better filter than the default box-filter openGL provides. Does anybody know of some example code that shows how to use a shader to define the various mipmap levels for a FBO render target texture?

Thanks in advance

Read the spec:

Usage Example #5

            // custom-generate successive mipmap levels
            glBindTexture(GL_TEXTURE_2D, color_tex);
            foreach (level > 0, in order of increasing values of level) {
                                          GL_TEXTURE_2D, color_tex, level);
                glTexParameteri(TEXTURE_2D, TEXTURE_BASE_LEVEL, level-1);
                glTexParameteri(TEXTURE_2D, TEXTURE_MAX_LEVEL, level-1);

                <draw to level>
            glTexParameteri(TEXTURE_2D, TEXTURE_BASE_LEVEL, 0);
            glTexParameteri(TEXTURE_2D, TEXTURE_MAX_LEVEL, max);

Ok, does anybody have any example code on how the shader would write to mipmap level n while sampling from level n-1? I assumed that I could simply use textureLod( blah, blah, n-1 ), but that doesn’t seem to be working.

Thanks again