因为我在评论中回答了这个问题,所以这里有一个更直接的答案:
// width and height is 256 and max is 512
// texture coordinates
float uMax = (width / max);
float vMax = (height / max);
_texCoords[0] = 0.0; _texCoords[1] = vMax;
_texCoords[2] = uMax; _texCoords[3] = vMax;
_texCoords[4] = 0.0; _texCoords[5] = 0.0;
_texCoords[6] = uMax; _texCoords[7] = 0.0;
Run Code Online (Sandbox Code Playgroud)
现在使用这些 texcoords 进行渲染,您可以将 256x256 纹理粘贴到 512x512 缓冲区中。您要使用的宽度和高度可以是等于或小于最大尺寸的任何尺寸。
| 归档时间: |
|
| 查看次数: |
1533 次 |
| 最近记录: |