16bit Texture with odd sized width is sheering

后端 未结 1 716
遥遥无期
遥遥无期 2021-01-20 15:59

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         


        
相关标签:
1条回答
  • 2021-01-20 16:49

    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.

    0 讨论(0)
提交回复
热议问题