再问下纹理坐标映射的小问题。。
我要映射的是第2个按钮,
核心代码:
float x = 0, y = 0;float width = 64, height = 96;// 纹理图片中要映射的那部分纹理坐标// 这个纹理坐标我用PS精准的检验了下,没问题float left = 0;float top = 24;float right = 59;float bottom = 43;CustomVertex objData[] ={ { x, y, 0, 1, col, left/width, top/height }, { right-left+x, y, 0, 1, col, right/width, top/height }, { right-left+x, bottom-top+y, 0, 1, col, right/width, bottom/height }, { right-left+x, bottom-top+y, 0, 1, col, right /width, bottom/height }, { x, bottom-top+y, 0, 1, col, left/width, bottom/height }, { x, y, 0, 1, col, left/width, top/height }}; // 移半个像 for (int i=0; i<6; i++) { objData[i].tu += (0.5/64.0f); objData[i].tv += (0.5/96.0f); }