且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

纹理不能正确拉伸。这是为什么发生?

更新时间:2022-12-22 20:33:12

It looks like the texture is getting padded out to the nearest power of two. There are two solutions here:

  1. Stretch the texture out to the nearest power of two.
  2. Calculate the difference between your texture's size and the nearest power of two and change the texture coordinates from 1.0f to textureWidth/nearestPowerOfTwoWidth and textureHeight/nearestPowerOfTwoHeight.

There might also be some specific LWJGL method to allow for non-power-of-two textures, look into that.