how to blend from texture to texture (without using color buffers)

I need to blend a lot of small 2D textures into a big 2D texture. I read an old thread here and it recomended glCopyTexSubImage.

I got two problems with the solution:
-I can not select the size of the source which is a color buffer (can I use a texture instead?)
-I get no blending just a plain copy, using the code below:

If I understand your requirements correctly (tiling small textures with some alpha blended overlap into a big texture?) you can use the render-to-texture extension, and enable blending while drawing using quads textured with your smaller textures. Or you could do your composition using a pbuffer directly and do the copy to texture yourself. Or you could use the back buffer and do the copy to texture yourself.

Your readback will do no blending in the texture. It sounds like you want to copytexture and use the framebuffer alpha in the copy process to blend with the texture you are copying to. You CANNOT do this, OpenGL does not blend with a copy like this.

If you want the equivalent result then draw the texture to the destination buffer on a quad first, then draw your effect then copy to texture. Knackerd’s suggestion of render to texture would also work and eliminate nasty filtering and pixel alignment issues with the texture on quad render.

If all you want is alpha copied to texture in addition to rgb then you need to make sure that the framebuffer and the texture both have alpha, but I’m guessing you aren’t really trying to do this.

[This message has been edited by dorbie (edited 09-03-2003).]

Thanks, I tryed knackered’s solution and it works fine. I thought it wasted too many resources for the 3D vertex transformations when I only need 2D. However it does not seem to be a problem in my project.

To dorbie about my blending test:
I thought it was the easiest and most robust way to test whether the blending was supported (simply to avoid initializing the alpha channel)