texSubImage2D

open override fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, type: Int, buffer: ByteArray?)

Replace a sub-rectangle of an already-allocated 2D texture. Cheaper than texImage2D for steady-state video uploads — re-uploads pixels into existing storage rather than re-allocating the GPU image. Caller must ensure the texture was previously sized with texImage2D at the matching width/height.


open override fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, type: Int, offset: Int)

PBO variant: read pixels for texSubImage2D from the buffer currently bound to GL_PIXEL_UNPACK_BUFFER, starting at byte offset within the buffer object. The driver copies asynchronously, so the GL thread doesn't block on pixel transfer. Requires GLES3+ / WebGL2 / GL3+.