OpenGL texture tilted

我们两清 提交于 2019-12-04 14:21:47

This is probably a padding/alignment issue.

GL, by default, expects rows of pixels to be padded to a multiple of 4 bytes. A 1366 wide texture with 1 byte or 3 byte wide pixels, will not be naturally 4 byte aligned.

Possible fixes for this are:

  • Tell GL how your texture is packed, using (for example) glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  • Change the dimensions of your texture, such that the padding matches without changing anything
  • Change the loading of your texture, such that the padding is consistent with what GL expects
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!