glTexSubImage2D

Texture sizes must be powers of 2 (e.g. 512 x 512).

Some data, such as video, is not powers of 2.

glTexSubImage2D allows one to load a portion of a texture.

For non-powers-of-two textures, create a larger texture (e.g. 1024 x 512), and sub-load the video data into it.

  glTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset,
                  width, height, format, type, pixels)

Texture coordinates will have to use smaller range (not 0 ... 1) -
For a 640 pixel wide video in a 1024 pixel wide texture, S coordinate ranges from 0 to 0.625

Texture transformation matrix can be used to adjust texture coordinates

next