PDA

View Full Version : subimaging a texture to itself?



Registered User
12-24-2011, 01:43 AM
Can gltexsubimage* copy a subregion of a texture on to a subregion of itself?

e.g., can it take the upper left 10x10 pixel area of a texture and copy it to the lower right corner of the same texture?

I know this can be accomplished several other ways, but I mean specifically, can gltexsubimage* do it? Seems like it can, because I can almost make it work... The exception being that the subimage comes out scrambled. Am I calculating the offset into the texture data like a moron?

Alfonse Reinheart
12-24-2011, 02:18 AM
glTexSubImage does not copy a region from a texture. It simply loads a texture region from the pixel data you provide. So it cannot copy from itself, because the function doesn't copy from textures.

If that pixel data just so happened to be in the same allocated memory that you used for a prior glTexImage call, then so be it. OpenGL neither knows nor cares.

Aleksandar
12-24-2011, 02:26 AM
It shouldn't be possible. The reason is obvious, the last parameter is a pointer to a CPU memory. CopyImageSubDataNV is the function that copies directly from one texture to the other, but it is a vendors-specific stuff.