uploading a very large texture in smaller blocks ?


I have a very large (let’s say 8192x8192), dynamically generated texture array on the CPU side. Part of the data is updated each time the user does an action.
Is there a simple way to upload it to the GPU in blocks of 2048x2048 (for compatibility with older GPUs) ?

The problem is that i can’t directly map glTexture2D onto my array for uploading because my array is a continuous set of data, so if I glTexture2D(2048,2048) with a pointer to my array it will actually take the first 8192x512 from the array and map it to 2048x2048 on the GPU side, which is obviously wrong.

Any tip ?

What about using only glTexSubImage2D on 2kx2k blocks ?
On the CPU side you will have to work on 16 arrays of 2k² size.

On the CPU side I can’t (don’t wan’t to) cut my large array in 16 arrays, it would not make sense anymore as for the various process which are applied to it.
I’ve been told I could use glTexSubImage2D+glPixelStore to upload part of my large array…

See the documentation for GL_UNPACK_ROW_LENGTH.