PDA

View Full Version : glCopyTexImage2D



crista
06-10-2003, 03:16 AM
My problem is that when I use
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,0,0,256,2 56,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?

roffe
06-10-2003, 03:47 AM
Originally posted by crista:
My problem is that when I use
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,0,0,256,2 56,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.

crista
06-10-2003, 04:05 AM
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,25 6);