GlTexSubImage2D
lastmod 2026-11-10created 2021-05-084 edits
glTexSubImage2D is an OpenGL function that updates part of an existing 2D texture with new pixel data. Whereas glTexImage2D allocates new texture storage and defines the whole texture, this function leaves the existing storage as is and changes only the rectangular region specified by xoffset, yoffset, width, and height, so it is cheaper. For video frames or dynamic textures that change every frame, it is common to allocate first with glTexImage2D and then update with this function.