glTexImage3D reload/refresh

I have malloc-ed data in a buffer. I run glTexImage3D and supply the data as a parameter. Everything works fine. I make changes to the data. I rerun glTexImage3D. Everything works fine and I can see the changes that were made on the screen. The problem is that this is a rather slow process. Rerunning glTexImage3D to reload/refresh the data in malloc-ed memory takes time. Is there any faster way of doing this?

You should use glTexSubImage3D for uploading new data to an already existing texture. You can pick pixel transfer parameters that your implementation won’t have to convert. And you can use pixel buffers to make the transfer asynchronous, but this will only be “faster” if you have something you could be doing while the transfer is going on.

I suggest that you use a format that is directly supported by the GPU. Example, all cards support B8G8R8A8 (GL_BGRA).

I tried glTexSubImage3D and I tried glCopyTexSubImage3D and stopwatch showed pretty much the same benchmark timing as when I just ran glTexImage3D over again. It didn’t seem to speed things up.