我知道整个精灵表必须是2的幂,但是当我只使用它的一部分时,该部分是否还需要是2的幂?
答案 0 :(得分:0)
没有。纹理坐标从0到1作为浮点数。
纹理坐标Ex:
final float texCoords[] = {
0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f,
1.0f, 0.0f
};
要获得某个位置,请获取'%'
例如:
quad.SetTexCoordinates( ((float) posX / texture.Width), //X
((float) posY / texture.Height), //Y
((float) width / texture.Width), //Width
((float) height / texture.Height)); //Height
//All are between 0 and 1 as a 'percent'