glCopyTexImage2D

My problem is that when I use
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,0,0,256,256,0);
to copy a texture from the frame buffer to update it, the new texture is greather than the original.
somebody knows why it happens?

Originally posted by crista:
My problem is that when I use
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,0,0,256,256,0);
to copy a texture from the frame buffer to update it, the new texture is greather than the original.
somebody knows why it happens?

First of all, when you use glCopyTexImage* instead of glCopyTexSubImage*, gl will allocate memory for this new texture. Second, since you specified GL_RGBA as the INTERNAL FORMAT gl will choose the format of your texture. Most likely you want to specify GL_RGBA8 as the internal format when you create the texture object(glTexImage*),and also when you copy it.

I try with glCopyTexSubImage2D, but my image is greather than the original image too. I think I must use this function, but if I copy the image from the frame buffer, the results are not the awaited ones because the new image is bigger.

Now I do this:
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,256,256);