View Full Version : glCopyTexSubImage2D

06-10-2003, 02:07 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?

Leyder Dylan
06-10-2003, 06:21 AM
If the original texture is smaller that the sub one, it's normal.

06-10-2003, 07:00 AM
The original texture and the final texture are the same.
Iīm trying to render a texture using glCopyTexSubImage2D or glCopyTexImage2D, but the new updated texture is bigger than the original.
I donīt know what happens :'( with my code.
I have a 300x300 window and my texture is 256x256. I show my texture first and itīs ok. Then, I try to render it. I do this:

glBindTexture(GL_TEXTURE_2D, texture[0]);
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,256,25 6);

06-10-2003, 09:18 AM
It wont shring your 300*300 window into a 256*256 texture. its just going to take the lower 256*256 pixels and transfer them to the texture, and it will look bigger

Leyder Dylan
06-10-2003, 10:35 AM
Try this :

32,32 ==> The position to add the texture

glTexSubImage2D(GL_TEXTURE_2D, 0, 32, 32, pTextureImage->sizeX,
pTextureImage->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pTextureImage->data);

06-10-2003, 10:43 AM
Thanks for your replies, itīs just fixed!!!
I change the window size to 256x256 and it works jjjj.

06-10-2003, 11:14 AM
Now I have two textures:
texture[0] and texture[1]

With glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,256,25 6), I change the texture previously selected with the function glBindTexture(GL_TEXTURE_2D, texture[1])

I want my texture[1] was the original texture.