View Full Version : uploading a very large texture in smaller blocks ?

11-06-2009, 02:58 AM

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 ?

11-06-2009, 05:06 AM
What about using only glTexSubImage2D on 2kx2k blocks ?
On the CPU side you will have to work on 16 arrays of 2kČ size.

11-06-2009, 05:17 AM
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...

11-06-2009, 08:45 AM
See the documentation for GL_UNPACK_ROW_LENGTH.