Some context: I have a project which creates thumbnails of textures when they are loaded to be used in the GUI. This is achieved by attaching the texture to a framebuffer and using glReadPixels. It works perfectly, but: If a texture from which a thumbnail was generated is then used later on during rendering, the frame rate drops dramatically. I got rid of all the relevant code except for the part that attaches the texture to the framebuffer, and the same slow-down persists.

So the problem boils down to: I call the following code during initialization, after the texture with name "texID" is created and no longer bound, and after an FBO is bound:

Code :
            //attach texture
        gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, 
            GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_2D, texID, 0);
 
        //specify drawbuffers and readbuffers
        gl.glDrawBuffer(GL2.GL_NONE);
        gl.glReadBuffer(GL2.GL_COLOR_ATTACHMENT0);
 
        //check if it worked
        int status = gl.glCheckFramebufferStatus(GL2.GL_FRAMEBUFFER);
        if(status != GL2.GL_FRAMEBUFFER_COMPLETE){ 
            throw new Error("FBO status is not GL_FRAMEBUFFER_COMPLETE."); }
 
        //set appropriate viewport
        gl.glViewport(0, 0, width, height);
 
        //don't do anything (normally glReadPixels stuff would go here)
 
 
        //detach texture
        gl.glFramebufferTexture2D(GL2.GL_FRAMEBUFFER, 
            GL2.GL_COLOR_ATTACHMENT0, GL2.GL_TEXTURE_2D, 0, 0);

Now I render a bunch of stuff, none of which uses "texID", at about 95 fps. If instead I render the stuff using the texture "texID", the frame rate drops to about 50. If I render the stuff using the texture "texID", but do not do the code snippet above, then it renders at about 95 fps.

Am I missing something obvious?

Extra info: The project is written in Java, using JOGL 2.0, running on Ubuntu 10.04 LTS; graphics card is AMD Radeon HD 6700, Catalyst version 11.12.