rendering only to a part of a texture?

Can I bind a 2000x2000 texture to a color attachment in a FBO, and tell OpenGL to behave exactly as if the texture was smaller, let’s say 1000x1000?

The point is, in my rendering cycle I need many (mostly small) intermediate textures to render to, but I need only 1 at a time. I am thinking that, rather than creating many smaller textures, I will have only 1 appropriately large, and I will bind it to an FBO at hand, tell OpenGL to render only to part of it, and save memory.

Or maybe I should be destroying/recreating those textures many times per frame? That would certainly save even more memory, but wouldn’t that cause a noticeable slowdown?

Just set a viewport (using glViewport) specifying the part you wish to render to. Yes, destroying and creating GPU resources per frame will be slow.

In addition to setting the glViewport, you’re going to want to glEnable( SCISSOR_TEST ) and set the scissor rectangle (glScissor). This to ensure that fragments outside of the viewport aren’t rasterized.