我猜它会变得迟钝,因为您要在屏幕上绘制数百个四边形,如果太多,它将成为 CPU 瓶颈并降低帧速率。但另一个答案实际上可能是原因:如果你在不使用 mip 映射的情况下显着缩小纹理,它真的会消耗 GPU 时间。
由于这只是一个重复的纹理,您只需要为整个屏幕绘制一个四边形。首先,当您加载纹理时,请确保它重复:
bg.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
//call this only one time, after you instantiate the Texture
然后,您可以在屏幕上绘制一个四边形,并将顶点的 UV 设置为足够大,以满足您希望它平铺的次数。
// bottom left corner...wherever you want to put it.
float bottomY = 0;
float leftX = 0;
//width and height of background. This is just an example. By the way, Java
//convention is for all variable names to start with a lower-case letter,
//to avoid confusion.
float width = screenWidth;
float height= screenHeight;
//I'm using RATIO like you are, which I think is the reciprocal of how much
//you want to scale the texture up. By the way, it is convention to make
//constant variable (static final primitives in Java) names be in all caps.
float uRight = width * RATIO / bg.getWidth();
float vTop= height * RATIO / bg.getHeight();
batch.draw(bg, leftX, bottomY, width, height, 0, 0, uRight, vTop);