I am uploading a 35 x 100 16bpp texture with the following OpenGL command:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RG8, 35, 100, 0, GL_RG, GL_UNSIGNED_BYTE, pixelD
Textures have an alignment they must meet at the end of each scanline (horizontal row), usually a default of 4 bytes. If this alignment isn't met, the texture will need padding at these locations that you yourself must provide in the uploaded pixel data. This isn't usually a concern until you mix non-pow2 texture sizes with less than 32bit per pixel texture data.
Using glPixelStorei()
can adjust this requirement to an alignment of 2 or 1 as necessary, or you can simply ensure texture sizes align to a multiple of 4 when dealing with 16bit textures.